Delete
You can "communicate" with your variable in a heap by using the pointer:
123int *x = new int; *x = 42; cout << *x;
If the RAM space we use for our code runs out, the program will crash. Your RAM is not limitless, and after the program execution, we should always take care of clearing the area in memory that we originally allocated:
To clean the space in your code, use the keyword delete and the pointer, which contains the address of the memory we want to free:
delete x;
Remember! For each new operator should always exist delete!
Takk for tilbakemeldingene dine!
Spør AI
Spør AI
Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår
Still meg spørsmål om dette emnet
Oppsummer dette kapittelet
Vis eksempler fra virkeligheten
Awesome!
Completion rate improved to 2.94
Delete
Sveip for å vise menyen
You can "communicate" with your variable in a heap by using the pointer:
123int *x = new int; *x = 42; cout << *x;
If the RAM space we use for our code runs out, the program will crash. Your RAM is not limitless, and after the program execution, we should always take care of clearing the area in memory that we originally allocated:
To clean the space in your code, use the keyword delete and the pointer, which contains the address of the memory we want to free:
delete x;
Remember! For each new operator should always exist delete!
Takk for tilbakemeldingene dine!