gcc long long int width与int相同

问题描述 投票:0回答:2

我正在测试cc版本8.2

gcc似乎将long long int视为int。有任何解决这个问题的方法吗?这是代码

#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
#include <float.h>

int main(int argc, char** argv) {

    printf("INT_MAX     :   %d\n", INT_MAX);
    printf("INT_MIN     :   %d\n", INT_MIN);
    printf("LONG_MAX    :   %ld\n", (long) LONG_MAX);
    printf("LONG_MIN    :   %ld\n", (long) LONG_MIN);
    printf("UINT_MAX    :   %u\n", (unsigned int) UINT_MAX);
    printf("ULLONG_MAX   :   %lu\n", (unsigned long long int) ULLONG_MAX);
    printf("Big Integer   :   %lu\n", (unsigned long long int) 1234567890123456);

    printf("%d\n", sizeof(long long int));
    return 0;
}

输出:

INT_MAX     :   2147483647
INT_MIN     :   -2147483648
LONG_MAX    :   2147483647
LONG_MIN    :   -2147483648
UINT_MAX    :   4294967295
ULLONG_MAX   :   4294967295
Big Integer   :   1015724736
8

C:\ prog_c \ c_pro> gcc --versiongcc(MinGW.org GCC-8.2.0-5)8.2.0版权所有(C)2018自由软件基金会,公司...

c gcc 64-bit long-integer
2个回答
1
投票

您使用错误的格式说明符进行打印。


0
投票
[printf需要知道longlong long之间的区别,并且与%lld(有符号)或%llu(无符号):
© www.soinside.com 2019 - 2024. All rights reserved.