#include<iostream>
#include<cstdio>
#include<cstdlib>
using namespace std;
struct point{
int edg;
char *name;
};
/*int main()
{
point p1;
p1.edg = 32;
point p2 = p1;
p1.edg = 40;
cout << p1.edg << " " << p2.edg << endl;
system("pause");
return 0;
}*/
int main()
{
point * p1 = (point *)malloc(sizeof(point));
p1 -> edg = 32;
point * p2 = p1;
p1 -> edg = 40;
cout << p2 -> edg << endl;
system("pause");
return 0;
}
结构体指针指向的是位置,改变之后。p2也会改变