- 论坛徽章:
- 0
|
本帖最后由 2012nimeng 于 2012-05-26 11:45 编辑
/*prinf2.c -- printf( )更多的属性 */
1 #include<stdio.h>
2 int main(void)
3 {
4
5 unsigned int un = 3000000000;
6 short end = 200;
7 long big = 65537;
8 long long verybig = 12345678908642;
9
11 printf("un = %u and not %d\n", un, un);
12 printf("end = %hd and %d\n", end, end);
13 printf("big = %ld and not %hd\n", big, big);
14 printf("verybig= %lld and not %ld\n", verybig, verybig);
15
16 return 0;
17
18 }
下面是用ubuntu10.04虚拟机下gcc编译过程中的错误
nimeng@nimeng-desktop:~$ gcc -g -o printf2 printf2.c
printf2.c: In function ‘main’:
printf2.c:5: warning: this decimal constant is unsigned only in ISO C90
printf2.c:8: warning: integer constant is too large for ‘long’ type
printf2.c:13: warning: format ‘%hd’ expects type ‘int’, but argument 3 has type ‘long int’
printf2.c:14: warning: format ‘%ld’ expects type ‘long int’, but argument 3 has type ‘long long int’
这是c primer plus 书中的代码求高人指点下是不是gcc编译器不支持那些数据类型啊?本人人们不久!!!
|
|