This page contains the exercises for the material System services and exceptions.
Give feedback on this content
Comments about these exercises
#define PI 3.1416
printf("%c", character);there are two arguments: "%c" format template and the contents of the character variable.
else if. A set of conditional statements linked together by else keywords are called conditional structures.
-o) or a word (or multiple words connected with dashes) prefixed with two dashes (e.g.
--system. Some flags are Boolean flags which means they are either on (if present) or off (if not present). Other flags take a parameter which is typically put after the flag separated either by a space or = character (e.g.
int counter = 0;or separately. If a variable has not been initialized, its content is whatever was left there by the previous owner of the memory area.
int number;. When a variable is introduced, memory is reserved for it even though nothing is written there yet - whatever was in the memory previously is still there. For this reason it's often a good idea to initialize variables when introducing them.
"%c"can only receive a char type variable.
int* value_ptr;creates a pointer to an integer. The contents of the memory address can be fetched by prefixing the variable name with * (e.g.
*value_ptr. On the other hand, the address of a memory adress can be fetched by prefixing a variable name with &, (e.g.
math.sin). In C libraries are taken to use with include, and unlike Python import it brings the library's namespace into the program's global namespace.
if __name__ == "__main__":if statement. In C there is no main program as such, code execution starts with the main function instead.
char animal = "donkey";where the number is the size of the array + 1. The +1 is neede because the string must have space for the null terminator '\0' which is automatically added to the end of the "string".
floating = (float) integer}. It's also noteworthy that the result must be stored in a variable that is the proper type. it is not possible to change the type of an existing variable.
unsigned int counter;.
while (sum < 21).