C conditional expressions
Today, I learned the C language expression. if it is else, if it is else, or else it actually means the above! Here is an example: if (age> = 18) // if the age variable value is greater than or equal to 18 {printf ("you are an adult ");} else if (age> 4) // if age is less than 18 but greater than 4 // it can be understood separately that else corresponds to the top if, if it corresponds to the last else {printf ("fortunately you are not too young");} else // if the age is less than or equal to 4 {printf ("mama, guagua... "); // language, do not understand the switch case statement: for example: switch (num) {case 1: printf (" I am #1 \ n "); break; case 2: printf ("I am #2 \ n"); break; case 3: printf ("I am #3 \ n"); break; default: printf ("num error \ n"); break; \ default should be placed behind the last case. If there is no break, the subsequent code will be executed, regardless of whether the subsequent case matches, until the next break is met. Note: The condition must be "=" and cannot be "= ", an equal sign is a value, not a judgment. <Less> greater than = equal to> = greater than or equal to <= less than or equal! = Not equal to & logical and "and" | logical or "or "! The logic is not "Opposite"