#include// stack is typically an area of memory which has a predefined size, usually around 2 megabyte or so.// // heap is an area that is also kind of predefined to a default value however it can grow as the application goes on.// // the physical location of these 2 areas of memory is ultimately the same, in RAM.// they work differently but fundamentally what they do is the same.// the difference is how stack and heap allocate memory for us.// check out:DEBUG->WINDOW->MEMORY->MEMORY1structVector3{float x, y, z;Vector3():x(10),y(11),z(12){}};intmain(void){// stackint value =5;int array[5];
array[0]=1;
array[1]=2;
array[2]=3;
array[3]=4;
array[4]=5;
Vector3 vector;// heapint* hvalue =newint;*hvalue =5;int* harray =newint[5];
harray[0]=1;
harray[1]=2;
harray[2]=3;
harray[3]=4;
harray[4]=5;
Vector3* hvector =newVector3();delete hvalue;delete[] harray;delete hvector;
std::cin.get();}