Which of the following correctly describes the scope of a static variable declared inside a function?
ALocal to the function, retains value between function calls
BGlobal scope, initialized once
CLocal to the file only
DCreates a new instance on each function call
Correct Answer:
A. Local to the function, retains value between function calls
Explanation:
A static variable declared inside a function has local scope (visible only within that function) but persists for the entire program lifetime. Its value is retained between function calls and is initialized only once.
What is the default return type of a function in C if not explicitly specified?
Avoid
Bint
Cchar
Dfloat
Correct Answer:
B. int
Explanation:
In C, if a function's return type is not explicitly specified, it defaults to int. However, modern C standards require explicit return type declaration.
iGET uses cookies for essential site functionality, analytics, and ads personalization (via Google AdSense). By clicking "Accept", you consent to our use of cookies.
Privacy Policy ·
Disclaimer