Chinaunix首页 | 论坛 | 博客
  • 博客访问: 4524225
  • 博文数量: 1148
  • 博客积分: 25453
  • 博客等级: 上将
  • 技术积分: 11949
  • 用 户 组: 普通用户
  • 注册时间: 2010-05-06 21:14
文章分类

全部博文(1148)

文章存档

2012年(15)

2011年(1078)

2010年(58)

分类: C/C++

2011-05-14 21:07:02

    int              a = 2439;  //%d
    unsigned int     b = 43245; //%u

    long             c = 32984785; //%ld
    unsigned long    d = 140245902;//%ul

    long long        e = 123456789;  //%lld
    unsigned long long f =1234566789;//%ull


int        %d            unsigned int  %u
long       %ld           unsigned long %lu
long long  %lld          unsigned long long %llu


  1. #include <stdio.h>

  2. int main(int argc, char *argv[])
  3. {
  4.     int a = 2439; //%d
  5.     unsigned int b = 43245; //%u

  6.     long c = 32984785; //%ld
  7.     unsigned long d = 140245902;//%ul

  8.     long long e = 123456789; //%lld
  9.     unsigned long long f =1234566789;//%ull

  10.     printf("int a=2439 10:=%d, 8:=%o, 16:=%x\n",a,a,a);
  11.     printf("unsigned int b=43245 10:=%u\n\n",b);
  12.     printf("long c=32984785 10:=%ld, 8:=%lo, 16:=%lx\n",c,c,c);
  13.     printf("unsigned long d=140245902 10=%lu\n",d);

  14.     return 0;
  15. }

  1. ywx@yuweixian:~/yu/professional/4$ ./int
  2. int a=2439 10:=2439, 8:=4607, 16:=987
  3. unsigned int b=43245 10:=43245

  4. long c=32984785 10:=32984785, 8:=175647321, 16:=1f74ed1
  5. unsigned long d=140245902 10=140245902
阅读(2469) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~