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?
int a[10];only declares a static array if the declaration is at file scope.static int a[10];would declare an array of static storage duration in block/function scope). I think you've been led astray by the common misnomer "dynamic array" formalloced objects,statichas a technical meaning that is not the complement of "dynamic" in the above sense.