~
~ Wrong. Try:
~
~ extern char lolo[];
~
~ Pointers and arrays are not the same thing. Although they can be used
~ interchangeably in *some* contexts, this *isn't* one of them.
well. seems to be true. What I actually did, is the visa-verse thing, i.g.
I used
char *lolo="foobar"; in both cases.
~ With
~
~ extern char lolo[];
~
~ the linker will treat the address which is associated with the symbol
~ `lolo' as the address of the first character in the array.
~
~ OTOH, with
~
~ extern char *lolo;
~
~ the linker will treat the address which is associated with the symbol
~ `lolo' as the address of a pointer (i.e. a 4/8 byte integer).
address of a pointer? could you clarify this.
so in this case, it just would store in variable lolo, the address of a
pointer, right, while, in case `char lolo[]="foobar";', it would store
there the address of the first character in array. Hmmm.. but it doesn't
make the difference to me..
~ Also, with `extern char *lolo', you would be able to do
~
~ lolo = <something>;
~
~ i.e. assign a different value to the pointer variable `lolo'. However,
~ with `extern char lolo[]', you can't do this, as `lolo' is effectively
~ a constant and not a variable.
~
ahmmm.. now it makes sence. So in my case when I had:
char foo[]="....";
it just had a constant, foo, which pointed to a string, which contained
"....", and when I used extern char *foo; in another code, compiler
happily pointed foo to that place of memory, right?
--
[EMAIL PROTECTED] http://www.kalug.lug.net