Intel Corporation Interview Question

When the keyword static is used in C?

Interview Answers

Anonymous

Jul 15, 2015

1. If a variable is defined as static within a function, it retains the value when the function is called multiple times. 2. If a variable is defined as static outside a function, it is global within the module. 3. If a function is defined as static, it can be used only within the module.

2

Anonymous

Apr 2, 2010

To preserve the value of a variable across functions calls.

1

Anonymous

Mar 29, 2012

Also when the variable or function is restricted to the file.