c语言long long类型赋值

long long unsigned int num = 20140701092715;

在C语言中编译器会把没有小数的数值常量默认为整形,这条语句编译器会报警告:

  [root@localhost ~]# gcc -o test 1.c
  1.c: In function ‘main’:
  1.c:6: warning: integer constant is too large for ‘long’ type

为了标识是long long类型,处理方法:将20140701092715指定为long long unsigned类型:

long long unsigned int num = 20140701092715ULL;

posted @ 2014-10-06 14:09  诚石  阅读(2592)  评论(0编辑  收藏  举报