// This program is used to test the pointer usage of C
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
char ch='A', *cptr;
int n1=50, n2, *nptr;
cptr= &ch;
nptr= &n1;
n2= *nptr;
printf("addr ch= %p\n", &ch);
printf("addr cptr= %p, cptr= %p\n", &cptr, cptr);
printf("addr n1= %p, addr n2= %p\n", &n1, &n2);
printf("addr nptr= %p\n", &nptr);
printf("n1= %3d, n2= %3d\n", n1, n2);
printf("size of n1=%4d", sizeof(n1));
printf("size of cptr=%d", sizeof(cptr));
printf("size of nptr=%4d", sizeof(nptr));
//system("pause");
return 0;
}
test_pointer.rar_The Test
版权申诉
138 浏览量
2022-09-20
10:06:23
上传
评论
收藏 37KB RAR 举报
御道御小黑
- 粉丝: 61
- 资源: 1万+