Types of storage and scope of each type
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / p.mathiazhagan
There four types of storage is available.
1)Automatic
2)external
3)static
4)register
The first three is explained before answer...
Register variable are not using the memory. It stored
in registers. It is mainly used to fast access then
previous storage. But, It has some limitation for declaring
the variable
| Is This Answer Correct ? | 0 Yes | 0 No |
What is setf in c++?
What do you mean by translation unit?
Is c++ still in demand?
class X { private: int a; protected: X(){cout<<"X constructor was called"<<endl;} ~X(){cout<<"X destructor was called"<<endl} }; Referring to the code above, which one of the following statements regarding "X" is TRUE? a) X is an abstract class. b) Only subclasses of X may create X objects. c) Instances of X cannot be created. d) X objects can only be created using the default copy constructor. e) Only friends can create instances of X objects.
What is auto used for in c++?
Can I create my own functions in c++?
Write a program that will count the number of digits in an input integer up to value MAX_VALUE (2147483647). Thus, for an input of 5837 the output should be 4 digits Make sure that your program works for the numbers 0, 1, and 10. For the number 0, the output should be 1 digit
What are protected members in c++?
Write a C++ Program to check whether a number is prime number or not?
Is it legal in c++ to overload operator++ so that it decrements a value in your class?
What are features of c++?
What is the difference between inline functions and macros?