Possible Duplicate:
Is array name a pointer in C?
C++ Static array vs. Dynamic array?
I’m learning C and I’m confused at what the difference is between the following two arrays:
int a[10];
and
int *b = (int *) malloc(10 * sizeof(int));
Just on the most basic level, what is the difference between these two?
is allocated on stack and is de-allocated as soon as the scope ends.
is allocated on heap and is alive throughout the lifetime of the program unless it’s explicitly freed.