Printf long long int in C with GCC?

前端 未结 4 1454
不知归路
不知归路 2020-12-07 22:25

How do I printf long long int and also unsigned long long int in C99 using GCC?

I have searched the other posts which suggest to use

4条回答
  •  爱一瞬间的悲伤
    2020-12-07 22:31

    For portable code, the macros in inttypes.h may be used. They expand to the correct ones for the platform.

    E.g. for 64 bit integer, the macro PRId64 can be used.

    int64_t n = 7;
    printf("n is %" PRId64 "\n", n);
    

提交回复
热议问题