ProgrammingEasyWipro · Capgemini pattern
Which storage class makes a local variable keep its value between calls to the function?
- A. auto
- B. static
- C. extern
- D. register
Correct answer: B. static
A static local is created once, initialised once and lives for the whole run, so its value survives between calls. auto and register locals are recreated on every call; extern only declares a variable defined elsewhere.
More C Programming questions
- The end of a C string is marked by:
- Which declaration makes p a pointer to an int?
- A line such as #include <stdio.h> is processed by:
- Which printf format specifier is meant for printing a pointer value (an address)?
- What is printed? c printf("%d", 10 / 3 3);
- What is printed? c int a = 5, b; b = a++ + 10; printf("%d %d", a, b);