Types of storage and scope of each type

Answer Posted / mike

Types of storage class variables in C++:
Automatic.
Extern.
static.

Automatic variables are those which are local to a function
and which are created when the function is called and
destroyed when the function is exited. The memory is
allocated and deallocated on the stack as and when the
function is called and exited.

External variables are global variables and are accessible
to all the functions in the program. They exist throughout
the program.Memory is set when they have have been declared
and will remain till the end of the program.

Static variables are like external varibles which will be
declared within a function and will maintain their values
between function calls.They also exist until throughout the
program

Is This Answer Correct ?    10 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How the keyword struct is different from the keyword class in c++?

787


Can constructor be private in c++?

782


Briefly describe a B+ tree. What is bulk loading in it?

988


What is the basic concept of c++?

745


What is the header file for setw?

809


What are the advantages of early binding?

825


What is a sequence in c++?

765


What are c++ variables?

781


Give the difference between the type casting and automatic type conversion. Also tell a suitable C++ code to illustrate both.

811


What is namespace std; and what is consists of?

932


What is auto used for in c++?

772


What is the use of function pointer?

751


Is facebook written in c++?

751


How can a struct in c++ differs from a struct in c?

804


We use library functions in the program, in what form they are provided to the program?

842