69,378
社区成员
发帖
与我相关
我的任务
分享
//addressofstack.c
#include <stdio.h>
#include <malloc.h>
#include <stdlib.h>
int main()
{
int i=0;
int *p=NULL;
printf("The address of system stack is: %p\n",&i);
//int *p=NULL; 这句放到前面...c是不允许在中意定义变量的.
p=(int *)malloc(1000);
printf("The address of system heap is: %p\n",p);
getchar();
return 0;
}
#include <stdio.h>
#include <malloc.h>
#include <stdlib.h>
int main()
{
int i=0;
int *p=NULL; // C要把变量定义放在函数开头
printf("The address of system stack is: %p\n",&i);
p=(int *)malloc(1000);
printf("The address of system heap is: %p\n",p);
getchar();
return 0;
}