使用malloc() 函数分配一个整形变量的内存空间,在使用完该空间后,使用free()函数进行释放,具体代码如下。
#include <stdio.h>
#include <stdlib.h>
int main(){
char *pInt;
pInt=(char *)malloc(sizeof(char));
*pInt=65;
printf("the graph is:%c\n",*pInt);
free(pInt);
return 0;
}
使用malloc() 函数分配一个整形变量的内存空间,在使用完该空间后,使用free()函数进行释放,具体代码如下。
#include <stdio.h>
#include <stdlib.h>
int main(){
char *pInt;
pInt=(char *)malloc(sizeof(char));
*pInt=65;
printf("the graph is:%c\n",*pInt);
free(pInt);
return 0;
}