/*
* Test command line parameters
*/
# Include <iostream>
Using namespace STD;
Int main (INT argc, char * argv []) {
Cout <argv [0] <Endl; // The first parameter is the applicationProgramName
Cout <argc <Endl;
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/*
* Use the Goto tag
*/
# Include <iostream>
Using namespace STD;
Int main (){
Int I = 4;
Flag:
Cout <I <Endl;
If (I! = 0 ){
I = 0;
Goto flag;
}
Return 0;
}
~~~~~~~~~~~~~~~ Strange local variables are not initialized ~~~~~~~~~~~~~~~~ ·
# Include <iostream>
Using namespace STD;
Int main (){
Int J;
For (INT I = 0, j = 0; I <5; I ++, J ++ );
Cout <j <Endl;
}
Here, if int I = 0 is used in the for loop, the compiler considers that J is only a local variable. The output J value is also a random number.
The reason is that the statement int I = 0, j = 0 is interpreted as declaring two local variables I, J at the same time, and assigning the initial value.
J declared before the for loop is blocked.