typedef-ing an array
Chris Torek
chris at mimsy.umd.edu
Fri Jul 6 02:04:49 AEST 1990
In article <25247 at mimsy.umd.edu> I made two typing errors:
>... typedef char foo[24]; ... [foo] has size 24*sizeof(char)==24 ...
> printf("%d\n", sizeof(foo));
>must print 42.
The last line above should read `24'.
>[main] may have either 0 arguments or two (int argc, char *argv).
The second argument should be `char **argv' (or equivalently `char *argv[]';
I recommend against the latter form since parameters declared as arrays
are not arrays, but this is the only place in C when a declaration does
not mean what it says, and this form leads programmers to believe that
arrays and pointers are `the same', which is not the case).
--
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain: chris at cs.umd.edu Path: uunet!mimsy!chris
More information about the Comp.lang.c
mailing list