How does the 'extern' keyword affect the scope and lifetime of a variable in C?
- It doesn't affect the scope or lifetime of a variable.
- It extends the scope and lifetime of a variable.
- It extends the scope but reduces the lifetime of a variable.
- It reduces the scope but extends the lifetime of a variable.
In C, the 'extern' keyword extends the scope of a variable but reduces its lifetime. It allows a variable declared outside a function to be used within that function, but the variable's lifetime remains outside the function.
Loading...
Related Quiz
- Using a union can lead to efficient memory usage when you need to store different ________ at different times.
- In a program that processes large datasets, you notice that reading the data from a file is a performance bottleneck. Which file handling functions could help improve the performance?
- What does the strlen function from the C standard library do?
- A two-dimensional array can be visualized as a ________.
- What is the purpose of the 'sizeof' operator in C?