{"id":2335,"date":"2014-05-13T11:02:36","date_gmt":"2014-05-13T11:02:36","guid":{"rendered":"http:\/\/blog.bachi.net\/?p=2335"},"modified":"2014-05-13T11:41:03","modified_gmt":"2014-05-13T11:41:03","slug":"c-printf-portable-format","status":"publish","type":"post","link":"https:\/\/blog.bachi.net\/?p=2335","title":{"rendered":"C printf() Portable Format"},"content":{"rendered":"<p><a href=\"http:\/\/www.nongnu.org\/avr-libc\/user-manual\/group__avr__inttypes.html\">inttypes.h: Integer Type conversions<\/a><br \/>\n<a href=\"http:\/\/manpages.ubuntu.com\/manpages\/intrepid\/man3\/avr_inttypes.3.html\">inttypes.h: Integer Type conversions<\/a><\/p>\n<pre class=\"brush: cpp; title: not portable; notranslate\" title=\"not portable\">\r\nunsigned int var = 12;\r\nprintf(&quot;hello %u world %x&quot;, var, var);     \/* &quot;hello 12 world c&quot; *\/\r\n<\/pre>\n<pre class=\"brush: cpp; title: portable; notranslate\" title=\"portable\">\r\nuint32_t var = 12;\r\nprintf(&quot;hello %&quot; PRIu32 &quot; world %&quot; PRIx32, var, var);     \/* &quot;hello 12 world c&quot; *\/\r\n<\/pre>\n<p><a href=\"http:\/\/stackoverflow.com\/questions\/12120426\/how-to-print-uint32-t-and-uint16-t-variables-value\">How to print uint32_t and uint16_t variables value<\/a><br \/>\n<a href=\"http:\/\/stackoverflow.com\/questions\/6454909\/warning-of-printf-format-not-suitable-for-a-variable-of-type-uint32-t\">warning of printf format not suitable for a variable of type uint32_t<\/a><br \/>\n<a href=\"http:\/\/stackoverflow.com\/questions\/4961115\/compiler-warning-about-printf-long-unsigned-int-and-uint32-t\">Compiler warning about printf() long unsigned int and uint32_t<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>inttypes.h: Integer Type conversions inttypes.h: Integer Type conversions unsigned int var = 12; printf(&quot;hello %u world %x&quot;, var, var); \/* &quot;hello 12 world c&quot; *\/ uint32_t var = 12; printf(&quot;hello %&quot; PRIu32 &quot; world %&quot; PRIx32, var, var); \/* &quot;hello 12 world c&quot; *\/ How to print uint32_t and uint16_t variables value warning of printf [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2335","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts\/2335","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2335"}],"version-history":[{"count":5,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts\/2335\/revisions"}],"predecessor-version":[{"id":2342,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=\/wp\/v2\/posts\/2335\/revisions\/2342"}],"wp:attachment":[{"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2335"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2335"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.bachi.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2335"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}