Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

What will this C code do?

Name: Anonymous 2012-01-19 8:24

void main(){
int x=1;
printf("%d\n",x=2);
}

Name: Anonymous 2012-01-22 15:25

>>146
An object has a storage duration that determines its lifetime. There are three storage durations: static, automatic, and allocated. An object whose identifier is declared with external or internal linkage, or with the storage-class specifier static has static storage duration. Its lifetime is the entire execution of the program and its stored value is initialized only once, prior to program startup.

I don't know they emphasized that the storage-class specifier static here, but if you use your common sense, a global variable with internal linkage was obviously declared with the static specifier.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List