Interview Questions

What does auto, static, public and extern variables means?

Mercury WinRunner FAQ


(Continued from previous question...)

What does auto, static, public and extern variables means?

auto: An auto variable can be declared only within a function and is local to that function. It exists only for as long as the function is running. A new copy of the variable is created each time the function is called.
static: A static variable is local to the function, test, or compiled module in which it is declared. The variable retains its value until the test is terminated by an Abort command. This variable is initialized each time the definition of the function is executed.
public: A public variable can be declared only within a test or module, and is available for all functions, tests, and compiled modules.
extern: An extern declaration indicates a reference to a public variable declared outside of the current test or module.

(Continued on next question...)

Other Interview Questions