摘要: 动态内存分配1.队列和栈的区别 : 栈中得变量 先进后出 ,队列中得变量 先进先出2.堆内存 一般由程序员分配和释放3.malloc: void *malloc(unsigned int size);//void * 表示任意类型的指针int * p = (int *)malloc(sizeof(int) * n);//(int *)强转类型 sizeof(int)分配的内存大小 *n元素个数char *str = malloc(8);strcpy(str, ”iPhone”);free(str);//标记删除,不清除内容4.Student *p = malloc(sizeof(Student 阅读全文
posted @ 2014-03-17 16:56 lxl奋小斗 阅读(185) 评论(0) 推荐(0) 编辑