msc*_*msc 2 c unsigned gcc int64
为什么以下程序出错?
#include <stdio.h>
int main()
{
unsigned int64_t i = 12;
printf("%lld\n", i);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
错误:
In function 'main':
5:19: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'i'
unsigned int64_t i = 12;
^
5:19: error: 'i' undeclared (first use in this function)
5:19: note: each undeclared identifier is reported only once for each function it appears in
Run Code Online (Sandbox Code Playgroud)
但是,如果我删除unsigned关键字,它工作正常.那么,
为什么unsigned int64_t i
会出错呢?
eml*_*lai 12
您无法unsigned
在类型上应用修改器int64_t
.它仅适用于char
,short
,int
,long
,和long long
.
你可能想要使用uint64_t
哪个是无符号的对应物int64_t
.
另请注意int64_t
等.在标题中定义,stdint.h
如果要使用这些类型,则应包括该标题.