Complete the code to declare a variable with block scope.
void function() {
[1] int x = 5;
}The auto keyword declares a variable with block scope and automatic storage duration by default in C.
Complete the code to declare a variable with static lifetime inside a function.
void function() {
[1] int count = 0;
count++;
printf("%d", count);
}The static keyword inside a function gives the variable static lifetime, so it keeps its value between function calls.
Fix the error in the code to correctly declare an external variable.
[1] int count; void function() { count = 5; }
The extern keyword declares a variable defined elsewhere, allowing access across files or scopes.
Fill both blanks to declare a global variable with internal linkage and initialize it.
[1] int [2] = 10;
static at global scope gives internal linkage, and count is the variable name.
Fill all three blanks to create a function that uses a static local variable and prints it.
void [1]() { [2] int [3] = 0; [3]++; printf("%d", [3]); }
The function name is increment, the variable is declared static to keep its value, and the variable name is counter.