I am new to C programming. Take a look at my code & point me where i am doing wrong? Here is my code to create a range function which should return int array.
#include<stdio.h>
int * range(int a, int b);
main()
{
int *r;
int j;
r = range(0,5);
printf("%d",r[0]); // getting the first one to check array but not working
// instead showing segmantation fault
}
int * range(int a, int b) {
int last[b];
int i,j;
for(i=a;i<b;i++){
last[i] = i;
}
return last;
}