将uintmax_t转换为字符串c

Cra*_*der 0 c

如何在C中将uintmax_t转换为字符串?

nos*_*nos 5

您将使用sprintf转换为字符串.对于诸如uintmax_t之类的类型,inttypes.h头文件包含这些类型的printf转换说明符.

#include <stdint.h>
#include <inttypes.h>
#include <stdio.h>

int main(int argc,char *argv[])
{
   char str[64];
   uintmax_t i = 123456;
   sprintf(str,"Value is %" PRIuMAX "\n",i);
   puts(str);
   return 0;
}
Run Code Online (Sandbox Code Playgroud)