char foo[] = bar;

utzoo!decvax!ucbvax!unix-wizards utzoo!decvax!ucbvax!unix-wizards
Fri Dec 11 17:36:29 AEST 1981


>From ihnss!cbosg!cbosgd!mark at Berkeley Fri Dec 11 17:29:38 1981
If you think about what the compiler has to do, you'll understand this.
char foo[] = "bar" will make foo an array of 4 characters, and the address
of foo will be the address of the first character.  char *foo = "bar" will
cause foo to be a pointer to some memory initialized as "bar\0", and the
address of foo will be the address of that pointer.  The compiler tries
to be smart about treating the two the same, as far as parameter passing
goes, but if the two modules are compiled separately it has no way to tell
which way the storage was allocated in the other module.



More information about the Comp.unix.wizards mailing list