Which storage class in C keeps a local variable alive for the entire program?
Correct answer
C. static
18 views
C. static
18 views
A local variable declared static is created once and retains its value between function calls. Variables with auto and register are created afresh on every call, and extern refers to a definition kept elsewhere.
Asked in: NTS, PPSC IT, Campus Interviews
Not sure why the answer is C? Ask here and get an explanation.