- 论坛徽章:
- 0
|
本帖最后由 xb_parasite 于 2011-05-14 20:47 编辑
编程测试一下好了
iphonebabe 发表于 2011-05-14 18:38 ![]()
有时候是不能让上机测的,要不很多问题就不成问题了。呵呵
不过这个我刚才试了一下,用gcc (Ubuntu 4.4.3-4ubuntu5) 4.4.3编译了一下,一大堆错误:
beffery@beffery-laptop:~/Programming$ gcc -c printfTry.c
printfTry.c: In function ‘main’:
printfTry.c:5: error: conflicting types for ‘p’
printfTry.c:3: note: previous declaration of ‘p’ was here
printfTry.c:5: warning: initialization makes integer from pointer without a cast
printfTry.c:6: warning: incompatible implicit declaration of built-in function ‘printf’
printfTry.c:6: error: ‘d’ undeclared (first use in this function)
printfTry.c:6: error: (Each undeclared identifier is reported only once
printfTry.c:6: error: for each function it appears in.)
printfTry.c:6: error: expected expression before ‘%’ token
被忽悠了,不知道出题者怎么想的。
- void main()
- {
- char* p;
- char a[10]={1,2,3,4,6,5,8,9,4,7},
- p=a;
- printf(""%d,%d"",*(p+2),*p+2);
- // char a[10]={1,2,3,4,6,5,8,9,4,7};
- // p=a;
- // printf(""%d,%d"",*(p+2),*p+2);
- }
复制代码 |
|