Search code examples
cdeclarationextern

Difference between array and pointer versions of external declarations


Are the following same:

extern int a[];

and

extern int *a;

I mean, are they interchangable?


Solution

  • No they are not. You'll see the difference when you try something like a++.

    There's plenty of questions about the difference between pointers and arrays, I don't think it's necessary to write more here. Look it up.