Question.1
A function returns a pointer to a local variable:
int* get_config() { int timeout = 500; return &timeout; } int *cfg = get_config(); printf("%d", *cfg);
What happens?
Select Answer
Prints 500 — the value is preserved after the function returns
Undefined behavior — timeout is a local variable that no longer exists after get_config
Prints 0 — local variables are zeroed after function exit
Compilation error — you cannot return a pointer to a local