【文档说明】C语言工程设计02_内存.pptx,共(28)页,2.489 MB,由精品优选上传
转载请保留链接:https://www.ichengzhen.cn/view-290365.html
以下为本文档部分文字说明:
C语言工程设计杨志钢zgyang@hrbeu.edu.cn内存划分内存划分内存划分内存划分内存划分内存划分内存划分内存划分内存的使用内存的使用内存的使用内存的使用内存的使用#include<malloc.h>voidmain(){int*p=(int*
)malloc(40);sizeof(p)=?_msize(p)=?}440//查看申请空间的大小内存的使用内存的使用#include<stdio.h>#include<stdlib.h>#include<string.h>intmain(){char*p=(char*)malloc(7)
;strcpy(p,"1234567");printf(“%s\n”,p);//能否正确打印?free(p+1);//能否正确释放?return1;}内存的使用#include<stdio.h>#include<stdlib.h>#include<string.h>intmain(){ch
ar*p=(char*)malloc(8);strcpy(p,"1234567");printf(“%s\n”,p);//能否正确打印?free(p);//能否正确释放?return1;}内存的使用内存相关库函数内存相关
库函数内存相关库函数内存使用注意事项内存使用注意事项内存使用注意事项死循环!icounta[0-4]count=4i=4count=5i=1内存使用注意事项内存使用注意事项内存使用注意事项内存使用注意事项