orrect answerDefault storage class of a variable is ________Optionsautoexternstaticregister
Question
Correct answer
Default storage class of a variable is ________
Options
auto
extern
static
register
Solution
The default storage class of a variable in C and C++ is auto.
Explanation
-
Auto: This storage class is the default for variables defined within a function or a block. Variables declared with auto are stored in the stack and have automatic duration, meaning they are created and destroyed when the program execution enters and exits the block.
-
Extern: This storage class is used for declaring a variable that is defined in another file or at a different scope. It does not provide a default storage class for variables.
-
Static: The static storage class is used to keep variables alive even after their block ends. However, it is not the default for local variables.
-
Register: This storage class suggests that the variable be stored in a register instead of RAM, but it is not a default storage class.
Final Answer
The default storage class of a variable is auto.
Similar Questions
orrect answerDefault storage class of a variable is ________Optionsautoexternstaticregister
BasicsWhat is storage class for variable A in below code?void main() { int A; A = 10; printf("%d", A);}Optionsautoexternregisterstatic
Which of the following is not a storage class specifier in C?a.Registerb.Automaticc.volatiled.External
Local variables are stored in an area called ___________OptionsPermanent storage areaHeapFree memoryStack
Select the correct answerWhich one is not supported by OOP?OptionsAbstractionEncapsulationGlobal variablesPolymorphism
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.