{"id":627,"date":"2015-05-21T06:32:03","date_gmt":"2015-05-21T06:32:03","guid":{"rendered":"https:\/\/ibex.tech\/c\/?p=627"},"modified":"2026-06-17T09:25:03","modified_gmt":"2026-06-17T08:25:03","slug":"variables-stdint-h-types","status":"publish","type":"post","link":"https:\/\/ibex.tech\/c\/c\/memory\/variables-stdint-h-types","title":{"rendered":"Variables &#8211; stdint.h types"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\nIn C99 the available basic integer types (the ones without _t) were deemed insufficient, because their actual sizes may vary across different systems. &nbsp;The C99 standard includes definitions of several new integer types to enhance the portability of programs. The new types are especially useful in embedded environments. &nbsp;All of the new types are suffixed with a _t and are guaranteed to be defined uniformly across all systems.\n<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">\nInteger Data Types<br>\n<\/h5>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td>\n<strong>C type<\/strong>\n<\/td><td>\n<strong>stdint.h type<\/strong>\n<\/td><td>\n<strong>Bits<\/strong>\n<\/td><td>\n<strong>Sign<\/strong>\n<\/td><td>\n<strong>Range<\/strong>\n<\/td><\/tr><tr><td>\nchar\n<\/td><td>\nuint8_t\n<\/td><td>\n8\n<\/td><td>\nUnsigned\n<\/td><td>\n0 .. 255\n<\/td><\/tr><tr><td>\nsigned char\n<\/td><td>\nint8_t\n<\/td><td>\n8\n<\/td><td>\nSigned\n<\/td><td>\n-128 .. 127\n<\/td><\/tr><tr><td>\nunsigned short or unsigned int\n<\/td><td>\nuint16_t\n<\/td><td>\n16\n<\/td><td>\nUnsigned\n<\/td><td>\n0 .. 65,535\n<\/td><\/tr><tr><td>\nshort or int\n<\/td><td>\nint16_t\n<\/td><td>\n16\n<\/td><td>\nSigned\n<\/td><td>\n-32,768 .. 32,767\n<\/td><\/tr><tr><td>\nunsigned int\n<\/td><td>\nuint32_t\n<\/td><td>\n32\n<\/td><td>\nUnsigned\n<\/td><td>\n0 .. 4,294,967,295\n<\/td><\/tr><tr><td>\nint\n<\/td><td>\nint32_t\n<\/td><td>\n32\n<\/td><td>\nSigned\n<\/td><td>\n-2,147,483,648 .. 2,147,483,647\n<\/td><\/tr><tr><td>\nunsigned long long\n<\/td><td>\nuint64_t\n<\/td><td>\n64\n<\/td><td>\nUnsigned\n<\/td><td>\n0 .. 18,446,744,073,709,551,615\n<\/td><\/tr><tr><td>\nlong long\n<\/td><td>\nint64_t\n<\/td><td>\n64\n<\/td><td>\nSigned\n<\/td><td>\n-9,223,372,036,854,775,808 .. 9,223,372,036,854,775,807\n<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">\n<em>(int can be 16 bits or 32 bits depending on the platform)<\/em>\n<\/p>\n\n\n\n<h5 class=\"wp-block-heading\">\nFloating Point Data Types<br>\n<\/h5>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td>\n<strong>C type<\/strong>\n<\/td><td>\n<strong>IEE754 Name<\/strong>\n<\/td><td>\n<strong>Bits<\/strong>\n<\/td><td>\n<strong>Range<\/strong>\n<\/td><\/tr><tr><td>\nfloat\n<\/td><td>\nSingle Precision\n<\/td><td>\n32\n<\/td><td>\n-3.4E38 .. 3.4E38\n<\/td><\/tr><tr><td>\ndouble\n<\/td><td>\nDouble Precision\n<\/td><td>\n64\n<\/td><td>\n-1.7E308 .. 1.7E308\n<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\">\nTypedef&#8217;s&nbsp;To Include For C99 stdint.h Types<br>\n<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>\n\/\/----- STDINT.H TYPE DEFINITIONS -----\n\/\/(Valid for XC16 &amp; XC32 microchip PIC compilers)\n#ifndef uint8_t\ntypedef unsigned char uint8_t;\n#endif\n\n#ifndef int8_t\ntypedef signed char int8_t;\n#endif\n\n#ifndef uint16_t\ntypedef unsigned short uint16_t;\n#endif\n\n#ifndef int16_t\ntypedef signed short int16_t;\n#endif\n\n#ifndef uint32_t\ntypedef unsigned long uint32_t;\n#endif\n\n#ifndef int32_t\ntypedef signed long int32_t;\n#endif\n\n#ifndef uint64_t\ntypedef unsigned long long uint64_t;\n#endif\n\n#ifndef int64_t\ntypedef signed long long int64_t;\n#endif\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>\n\/\/----- STDINT.H TYPE DEFINITIONS -----\n\/\/(Valid for XC8 microchip PIC compiler)\n#ifndef uint8_t\ntypedef unsigned char uint8_t;\n#endif\n\n#ifndef int8_t\ntypedef signed char int8_t;\n#endif\n\n#ifndef uint16_t\ntypedef unsigned short uint16_t;\n#endif\n\n#ifndef int16_t\ntypedef signed short int16_t;\n#endif\n\n#ifndef uint32_t\ntypedef unsigned long uint32_t;\n#endif\n\n#ifndef int32_t\ntypedef signed long int32_t;\n#endif\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>In C99 the available basic integer types (the ones without _t) were deemed insufficient, because their actual sizes may vary across different systems. &nbsp;The C99 standard includes definitions of several new integer types to enhance the portability of programs. The new types are especially useful in embedded environments. &nbsp;All of the new types are suffixed [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"class_list":["post-627","post","type-post","status-publish","format-standard","hentry","category-memory"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/c\/wp-json\/wp\/v2\/posts\/627","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/c\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/c\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/c\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/c\/wp-json\/wp\/v2\/comments?post=627"}],"version-history":[{"count":5,"href":"https:\/\/ibex.tech\/c\/wp-json\/wp\/v2\/posts\/627\/revisions"}],"predecessor-version":[{"id":1605,"href":"https:\/\/ibex.tech\/c\/wp-json\/wp\/v2\/posts\/627\/revisions\/1605"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/c\/wp-json\/wp\/v2\/media?parent=627"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/c\/wp-json\/wp\/v2\/categories?post=627"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/c\/wp-json\/wp\/v2\/tags?post=627"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}