|

楼主 |
发表于 2003-10-11 21:50:42
|
显示全部楼层
上面的都是照书抄的。
# gcc -c t0.c
t0.c: In function `main':
t0.c:4: warning: initialization makes pointer from integer without a cast
t0.c:6: error: `p' undeclared (first use in this function)
t0.c:6: error: (Each undeclared identifier is reported only once
t0.c:6: error: for each function it appears in.)
# cat t0.c
main()
{
int a=1;
int *p1=a;
/*scanf("%d",&i);*/
printf("%d\n",*p);
}
#
感到指针的使用格式真的是混乱,
有人能详细说说吗?
对不起,我这里网速很慢,不知道fingster已改正。
-----------------------------------------------------------
# cat t0.c
main()
{
int a=1;
int *p1=&a;
printf("%d\n",*p1);
int b=2,*p2;
p2=&b;
printf("%d",*p2);
int c=1,j=2,k,*p3=&c;
k=*p3+j;
printf ("%d",k);
}
# gcc -c t0.c
#
这些都是对的, ” k=*p3+j; “这里,既然*是声明p3是指针,怎么这里还要这样用?
|
|