GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — programming-c-cpp-learning/memory at master · eeyoo/programming-c-cpp-learning

Expand file tree

/

memory

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
/

memory

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
01.cpp
01.cpp
 
 
array.cpp
array.cpp
 
 
array1.cpp
array1.cpp
 
 
new_delete.cpp
new_delete.cpp
 
 
object.cpp
object.cpp
 
 
readme.txt
readme.txt
 
 

readme.txt

动态内存
=======
两种类型:
栈 在函数内声明所有变量将占有栈内存
堆 程序中为声明的变量,可能在运行中占有的内存

new 和 delete运算符
-------------------
new 用于请求内存空间,与malloc()方法相比,new可以创建对象。
delete 用于释放new分配的内存空间(尽管c++支持内存自动清理,手动释放占有空间依然推荐)

数组内存动态分配
---------------
二维数组
new array[len];
delete [] array;
多维数组
new array[len][len];
delete [] array;

对象内存动态分配(自定义数据类型)
--------------------------
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.