if we have code like this:
int c=0;
main()
{
cout<<c;
getch();
}
Then this variable will get space under which stack frame in a call stack?
if we have code like this:
int c=0;
main()
{
cout<<c;
getch();
}
Then this variable will get space under which stack frame in a call stack?
Hi, Global variables are stored neither in stack nor in heap. Every program (executable code) is typically divided into four sections.
Code
Data
Stack
Heap
Global variables along with constants/literals are stored in the Data section.