0
0
Cprogramming~10 mins

Extern storage class - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to declare an external variable.

C
extern int [1];
Drag options to blanks, or click blank then click option'
Aprintf
Bmain
Ccount
Dreturn
Attempts:
3 left
💡 Hint
Common Mistakes
Using a function name instead of a variable name.
Trying to declare a keyword as a variable.
2fill in blank
medium

Complete the code to define the external variable declared elsewhere.

C
int [1] = 10;
Drag options to blanks, or click blank then click option'
Acount
Bprintf
Cextern
Dmain
Attempts:
3 left
💡 Hint
Common Mistakes
Using extern keyword when defining the variable.
Using a different variable name than declared.
3fill in blank
hard

Fix the error in the code to correctly use the external variable.

C
extern int [1];

void printCount() {
    printf("Count is %d\n", [1]);
}
Drag options to blanks, or click blank then click option'
Amain
Bcount
Cprintf
Dreturn
Attempts:
3 left
💡 Hint
Common Mistakes
Using different names in declaration and usage.
Using function names instead of variable names.
4fill in blank
hard

Fill both blanks to declare and initialize an external variable correctly.

C
extern [1] [2];

// Defined in another file
Drag options to blanks, or click blank then click option'
Aint
Bfloat
Ccount
Dtotal
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing data type and variable name order.
Using a float type when the variable is integer.
5fill in blank
hard

Fill all three blanks to define and use an external variable properly.

C
int [1] = 5;

extern int [2];

void display() {
    printf("Value: %d\n", [3]);
}
Drag options to blanks, or click blank then click option'
Atotal
Bcount
Attempts:
3 left
💡 Hint
Common Mistakes
Using the same variable name for definition and external declaration.
Mismatching variable names in usage.