Programmer --- C language details 2
Main Content: ";" indicates details, symbol priority, and break;
# Include
/* The simplest C language program is main () {}. Note that some development environments may not be able to run this way. In cfree, it is said that the program is not properly positioned, in linux, if gcc is used for compilation and running, an integer is returned strictly because the function returns the int type */struct test {int a; int B; int c;} by default ;} // There is also a problem with or without ";". If not, the compiler will not report an error. // compile the struct as the return type of the function, only when it is followed by a function, // Of course, this situation is limited to the fact that the func () function is not declared before calling. If you put these programs behind the mian function, // and declare func () before the main function (), no return type is added, but the int type should be returned by default. Because the return type is determined at the time of declaration, compilation reports an error func () in this case () {printf ("test \ n");} int main (int argc, char * argv []) {/* 1. function pointer call. For example, p is a function pointer, the function that calls p must be written as (* p) (); and written as * p (). The compiler will interpret it as * (p ()); * 2. type conversion is also a single object operator. The single object operator is a combination of right and left. * p ++ is interpreted as * (p ++) by the compiler ), that is, take the object pointed to by the pointer p, and then increment p by 1; instead of * (* p) ++, that is, the object pointed to by the pointer p, and then increment this object by 1; */int j, I = 3; switch (I) {case 3: printf ("3 \ n"); case 1: printf ("1 \ n"); break; // This is I = 3; if the break is missing, it will always be executed to the place with a break. If there is no break, // It will be executed until the end of default; // if you need to not add a break, A good practice is to add comments, such as/* There is no break */case 2: printf ("2 \ n"); default: printf ("default \ n ");} while (I> = 0) // If ";" is added here, this loop will affect the code logic, however, no error is returned for these Compilation: {printf ("I = % d \ n", I); I --;} func (); // func (); can output printf information, the return type is not added; go to the above implicit error func; // The above func (); is a function call; nothing is done here, specifically, the computed function address is if (I <0) return; // if ";" is missing here, 5 is returned, and below is "I = 5; however, no error will be reported for these compilations. "// when your I> = 0, I = 5; is skipped, if this assignment is missing, the subsequent operations on the statement may be very latent. It is difficult to find a bug I = 5; j = 4; return 0 ;}
Output: