Skip to content

F) HEAP & STACK

kalinosia edited this page Mar 13, 2021 · 1 revision

HEAP and STACK

Sterta i stos

SCREENA WSTAWIĆ

Only Stack code without heap: -static memory allocation

#include <iostream>
int sum(int a, int b)
{
return a+b;
}
int main()
{
int a = 10;
int b = 20;
std::cout<<sum(a,b);
return 0;
}

Heap - dynamic allocation memory (...)

int* p;
p=new int;
*p=100; //(operator wyłuskania)
delete p;

Clone this wiki locally