ubuntu下打印unit64_t size_t uint32_t 类型

时间:2022-09-06 12:52:46
最近写c库时,发现需要对unit64_t  size_t   uint32_t这几个类型进行打印,总结一下:
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>

int main()
{
    size_t i = 1;
    uint32_t j = 2;
    uint64_t k = 3;
    printf("i: [%zu]\n",i);
    printf("j-->%"PRIu32"\n",j);
    printf("j-->%"PRIu64"\n",k);
    printf("hebing-->%"PRIu64 "%"PRIu32"\n",j,k);
    return 0;
}