摘要: 1、传址申请内存问题。看下面一个例子。struct complex_t //复数{ int real; //实数 int imag; //虚数};int create(complex_t *p, unsigned int n){ p = new complex_t[n]; //申请n个complex if(p == NULL) return -1; else return 0;}然后在main函数中调用该函数:complex_t *comps = NULL;if(create(comps, 10) < 0) //调用函数{ printf("create failed\n&quo 阅读全文
posted @ 2012-03-14 17:30 陈朋 阅读(267) 评论(0) 推荐(0) 编辑