《深入理解C指针》第二章 C的动态内存管理

2019-12-01

15:18:44

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

#include <bits/stdc++.h>
#include <stdlib.h>
#include <stdio.h>
using namespace std;
#define maxn 10005
#define M 105

int main(){
    int *p = (int *)malloc(sizeof(int));
    * p = 4;
    free(p);
    p += 10000000;
    printf("%d
",*p);
    system("pause");
    return 0;
} 

 造成了段错误。

 

 

 

 

原文地址:https://www.cnblogs.com/JasonPeng1/p/11966499.html