E
Eric Sosman
Randy said:Jordan Abel wrote
int main(){
char string[20]={""};
string[20] = {" connected "};
}
In addition to the more helpful comments you have already received,
"string" is an identifier reserved for use by the implementation, and
you should thus not use it. (IIRC, that statement only applies if
you've included <string.h>.)
His use of the identifier does not have external linkage, nor is at file
scope, so he should be fine, at least if he hasn't included string.h or
stdlib.h [possibly even if he has, but i don't know in that case]
Irrelevant. There is nothing to prevent ISO C 200x from using
that identifier, because it is reserved explicitly for such use.
So, a new compiler comes along, and suddenly the above code
stops working. With or without string.h.
It is difficult to choose identifiers that no future
C Committee will proclaim off-limits. Did you, by any
chance, use `restrict' as an identifier? If so, what do
you think of C90's guarantee that `restrict' was in the
name space reserved for your use?