C declarations

Fred jfn%vanderbilt.csnet at csnet-relay.arpa
Fri Jan 25 19:22:12 AEST 1985


   I have a question about C declarations.  The [] notation is equivalent
to the * notation, right?  We have

	int ptr[]   <=>   int *ptr

and 

	int *ptr[]  <=>   int **ptr


   The question concerns the [] syntax, which takes on a different meaning if 
data initialization occurs.  For example:

	int ptr[];	declares one pointer

but

	int ptr[] = { 1, 2, 3 };	declares a three element int array.


  Is this a desirable characteristic of C?  Could someone please comment on
the precise meaning of [] in declarations.

  Thanks, my address is
	CS-Net:  jfn at vanderbilt



More information about the Comp.lang.c mailing list