C++malloc之类的使用记录

 1 #include<iostream> 
 2 #include <vector>
 3 
 4 using namespace std;  
 5 
 6 int main()
 7 {
 8     int *a = (int*)malloc(4);
 9     a[0] = 4;
10     int *b = a;
11 
12     free(b);//释放了b,a也就释放了
13     return 0;
14 }

 

posted @ 2017-03-15 15:00  smile带着你  阅读(872)  评论(0编辑  收藏  举报