posted @ 2012-08-14 20:38 vivi_wind 阅读(10448) 评论(0) 推荐(1)
摘要:
转自http://www.cnblogs.com/evisie/archive/2011/08/04/2128051.html先看一个例子:struct student{ char* name; int score;}stu, *pstu;int main(void){ strcpy(stu.name, "Jimy"); stu.score =99; return0;}这是很多人都容易犯的错误:定义了结构体变量stu,但结构体内部的char * name在定义结构体时只是为其分配了4字节的内存,没有指向一个合法的地址,这时其指针指向的区域只是一些乱码,有事还没有访... 阅读全文
浙公网安备 33010602011771号