开发者

Convert uintmax_t into string c

How to convert uintmax_t into st开发者_如何学Goring in C?


You'd use sprintf to convert to a string. For a type such as uintmax_t , the inttypes.h header contains printf conversion specifiers for these types.

#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;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜