Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main () {
- int a = 5; // хранится в стэке
- double b = 4.4; // хранится в стэке
- Point c = {1.1, 3.2}; // хранится в стэке
- c.x = 2.1;
- // new, delete
- // стэк: тип_переменной имя_переменной
- // куча: тип_переменной* имя_переменной = new тип_переменной;
- int* a1 = new int;
- *a1 = 7;
- int a0 = 2, a2 = 3, a3 = 4;
- a2 = a0;
- a0 = a3;
- Point* c1 = new Point;
- *c1 = {1.1, 3.2};
- (*c1).x = 2.1; // <=> c1->x = 2.1;
- Point* c3 = nullptr;
- Point* c2 = c1;
- c2->y = 1.1;
- cout << c1->y;
- c2 = nullptr;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement