Question on declaration semantics

Curt Wohlgemuth curtw at hpcllca.HP.COM
Sat Jan 14 10:24:51 AEST 1989


I have a question on ANSI C declaration semantics.  Here is a code
snippet:

......... (file scope)

int a[5];
int a[] = {1, 2, 3};

......... (end of snippet)

Are these declarations an invalid combination?  (I.e., is this
non-conforming?)

And if these are valid, how about reversing them?

......... (file scope)

int a[] = {1, 2, 3};
int a[5];

......... (end of snippet)

As you can probably tell, I'm interested in just where the size of the
empty-bracketed "a" is to be "filled in".  Before the '=', or at the end
of the initializer?

Any and all comments would be appreciated.

Thanks,
Curt Wohlgemuth



More information about the Comp.std.c mailing list