Passing sizes of arrays without a separate argument for the length

Dave Martindale dave at onfcanim.UUCP
Wed Sep 21 14:48:00 AEST 1988


In article <8809191507.AA17512 at ucbvax.Berkeley.EDU> U23405 at UICVM (Michael J. Steiner) writes:
>
>AFTER (MY IDEA) : - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>main()
>{
>     char array[10];
>     ...
>     array[0] = 10;
>     somefunc(array);
>}

Hmm, how about

	char array[256];

	array[0] = 256;

Assuming you have 8-bit bytes, this doesn't work very well.
In fact, if you have signed characters, any char array of length >= 128
doesn't work.



More information about the Comp.lang.c mailing list