I know the problem is "&numbers = odds();"Code:#include <stdio.h> #define SIZE 5 int *odd(void); int main() { int numbers[SIZE]; int x; &numbers = odds(); for(x=0; x<SIZE; x++) printf("Element #%d = %d\n", x, numbers[x]); return(0); } int *odds(void) { int y[SIZE]; int x; for(x=0; x<SIZE; x++) y[x] = 2*x+1; return(y) }
and using pointer can fix it.
but I wanna know why?
the &numbers thing generates an address, and odds() returns a memory location.
I always think address is the same as memory location.
what are their differences? thx



LinkBack URL
About LinkBacks


