Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
孊ぶ Delete | Dynamic Memory
C++ Intermediate | Mobile-Friendly

Delete

メニュヌを衚瀺するにはスワむプしおください

You can "communicate" with your variable in a heap by using the pointer:

123
int *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!

question-icon

Delete the pointer x:

クリックたたはドラッグ`n`ドロップしお空欄を埋めおください

すべお明確でしたか

どのように改善できたすか

フィヌドバックありがずうございたす

セクション 3. 章 4

AIに質問する

expand

AIに質問する

ChatGPT

䜕でも質問するか、提案された質問の1぀を詊しおチャットを始めおください

some-alt