{"id":10026,"date":"2022-07-01T04:56:09","date_gmt":"2022-07-01T04:56:09","guid":{"rendered":"http:\/\/fastbitlab.com\/?p=10026"},"modified":"2023-08-26T15:42:10","modified_gmt":"2023-08-26T10:12:10","slug":"microcontroller-embedded-c-programming-lecture-53-sizeof-operator","status":"publish","type":"post","link":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-53-sizeof-operator\/","title":{"rendered":"Microcontroller Embedded C Programming Lecture 53 | Sizeof testing"},"content":{"rendered":"<div class=\"boldgrid-section\" style=\"background-image: linear-gradient(to left, #eeeeee, #eeeeee);\" data-bg-color-1=\"#EEEEEE\" data-bg-color-2=\"#EEEEEE\" data-bg-direction=\"to left\">\n<div class=\"container\">\n<div class=\"row\" style=\"padding-top: 35px; padding-bottom: 0px; background-image: linear-gradient(to left, #eeeeee, #eeeeee);\" data-bg-color-1=\"#EEEEEE\" data-bg-color-2=\"#EEEEEE\" data-bg-direction=\"to left\">\n<div class=\"col-md-1 col-sm-12 col-xs-12 col-lg-1\" style=\"padding: 0px 15px;\">\n<div class=\"boldgrid-shortcode\" data-imhwpb-draggable=\"true\">\n\n<\/div>\n<p class=\"\">&nbsp;<\/p>\n<\/div>\n<div class=\"col-md-10 col-sm-12 col-xs-12 col-lg-10\">\n<h1 class=\"\" style=\"text-align: center; font-size: 30px; border-width: 0px; line-height: 50px;\"><span style=\"color: #000080;\"><strong>Sizeof Operator<\/strong><\/span><\/h1>\n<div class=\"row bg-editor-hr-wrap\" style=\"border-width: 0px; margin-top: -25px;\">\n<div class=\"col-lg-12 col-md-12 col-xs-12 col-sm-12\">\n<div>\n<p>&nbsp;<\/p>\n<div class=\"bg-hr bg-hr-10 color2-color\" style=\"border-style: solid; border-width: 0px 0px 3px;\"><\/div>\n<p>&nbsp;<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">In this article, we learn about Sizeof operator. <\/span><\/span><\/p>\n<p class=\"\" style=\"font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\">Our newly created project, <strong>002Sizeof<\/strong>, employs the powerful printf functionality to display the sizes of various data types.&nbsp;<\/span><\/p>\n<figure id=\"attachment_10029\" aria-describedby=\"caption-attachment-10029\" style=\"width: 715px\" class=\"wp-caption aligncenter\"><img fetchpriority=\"high\" decoding=\"async\" class=\"wp-image-10029 \" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/06\/Figure-1-8-1024x557.png\" alt=\"Figure 1. 002Sizeof project\" width=\"715\" height=\"389\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-1-8-1024x557.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-1-8-300x163.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-1-8-768x418.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-1-8-600x326.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-1-8-1536x836.png 1536w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-1-8-120x65.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-1-8-500x272.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-1-8-200x109.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-1-8-400x218.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-1-8-800x435.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-1-8-1200x653.png 1200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-1-8.png 1869w\" sizes=\"(max-width: 715px) 100vw, 715px\" \/><figcaption id=\"caption-attachment-10029\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 1. 002Sizeof project<\/span><\/figcaption><\/figure>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">In main.c, first use the header file <\/span><b>#include &lt;stdio.h&gt;<\/b><span style=\"font-weight: 400;\">.<\/span><\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">After that, let me use printf to print the size of a char data type. The size of the char data type is <\/span><b>%u<\/b><span style=\"font-weight: 400;\"> because size is always unsigned, so that I can use <\/span><b>%u\\n<\/b><span style=\"font-weight: 400;\"> and <\/span><b>sizeof(char)<\/b><span style=\"font-weight: 400;\">. So, this seems to be good.<\/span><\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">After that, let me do it for the size of short, size of long, size of long long,&nbsp; size of int, and sizeof double, as shown below.&nbsp;&nbsp;<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Some people may have doubts, so why didn&#8217;t I use %d?&nbsp;<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">That&#8217;s because &#8216;d&#8217; is for signed integer. I know size cannot be negative. That&#8217;s why I used &#8216;u.&#8217; That is for unsigned. So, even if you use d, that&#8217;s not an issue; that is also correct.<\/span><\/p>\n<pre class=\"color-5-text-contrast color5-background-color\" style=\"font-size: 12px; box-shadow: #cecece 0px 0px 0px 0px inset;\"><span style=\"color: #ff99cc;\">#include<\/span> &lt;stdio.h&gt;\r\n<span style=\"color: #ff99cc;\">int<\/span> main(<span style=\"color: #ff99cc;\">void<\/span>)\r\n{\r\n   <span style=\"color: #ff00ff;\"> printf<\/span>(\"Size of char data type is %u\\n\",<span style=\"color: #ff99cc;\">sizeof<\/span>(<span style=\"color: #ff99cc;\">char<\/span>));\r\n    <span style=\"color: #ff00ff;\">printf<\/span>(\"Size of short data type is %u\\n\",<span style=\"color: #ff99cc;\">sizeof<\/span>(<span style=\"color: #ff99cc;\">short<\/span>));\r\n   <span style=\"color: #ff00ff;\"> printf<\/span>(\"Size of int data type is %u\\n\",<span style=\"color: #ff99cc;\">sizeof<\/span>(<span style=\"color: #ff99cc;\">int<\/span>));\r\n    <span style=\"color: #ff00ff;\">printf<\/span>(\"Size of long data type is %u\\n\",<span style=\"color: #ff99cc;\">sizeof<\/span>(<span style=\"color: #ff99cc;\">long<\/span>));\r\n    <span style=\"color: #ff00ff;\">printf<\/span>(\"Size of long long data type is %u\\n\",<span style=\"color: #ff99cc;\">sizeof<\/span>(<span style=\"color: #ff99cc;\">long long<\/span>));\r\n    <span style=\"color: #ff00ff;\">printf<\/span>(\"Size of double data type is %u\\n\",<span style=\"color: #ff99cc;\">sizeof<\/span>(<span style=\"color: #ff99cc;\">double<\/span>));\r\n    <span style=\"color: #ff99cc;\">for<\/span>(;;);\r\n}<\/pre>\n<p class=\"\" style=\"text-align: center;\"><span style=\"color: #000000;\">&nbsp;sizeof main.c code<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">After that, now let&#8217;s create the debug configuration. Select the project, go to <\/span><b>Debug As<\/b><span style=\"font-weight: 400;\">, and click on <\/span><b>Debug Configurations<\/b><span style=\"font-weight: 400;\">.&nbsp;<\/span><\/span><\/p>\n<figure id=\"attachment_10031\" aria-describedby=\"caption-attachment-10031\" style=\"width: 716px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" class=\"wp-image-10031 \" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/06\/Figure-3-6-1024x559.png\" alt=\"Figure 3. Go to debug configuration\" width=\"716\" height=\"391\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-3-6-1024x559.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-3-6-300x164.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-3-6-768x419.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-3-6-600x328.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-3-6-1536x838.png 1536w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-3-6-120x66.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-3-6-500x273.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-3-6-200x109.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-3-6-400x218.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-3-6-800x437.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-3-6-1200x655.png 1200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-3-6.png 1863w\" sizes=\"(max-width: 716px) 100vw, 716px\" \/><figcaption id=\"caption-attachment-10031\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 2. Go to debug configuration<\/span><\/figcaption><\/figure>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">And there is already one configuration which is for our previous project. Select <\/span><b>STM32 MCU Debugging<\/b><span style=\"font-weight: 400;\"> and double click, and it creates another one here for our current project <\/span><b>002Sizeof Debug<\/b><span style=\"font-weight: 400;\">, as shown in Figure 3.<\/span><\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">Here again, you have to go to the <\/span><b>Debugger<\/b><span style=\"font-weight: 400;\">, select the debug probe is <\/span><b>ST-LINK(ST-LINK GDB server)<\/b><span style=\"font-weight: 400;\">, and the <\/span><b>SWV is Enabled<\/b><span style=\"font-weight: 400;\">. Because we are using printf. So, click <\/span><b>Apply <\/b><span style=\"font-weight: 400;\">and click <\/span><b>Debug<\/b><span style=\"font-weight: 400;\"> to start debugging.<\/span><\/span><\/p>\n<figure id=\"attachment_10032\" aria-describedby=\"caption-attachment-10032\" style=\"width: 714px\" class=\"wp-caption aligncenter\"><img decoding=\"async\" class=\"wp-image-10032 \" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/06\/Figure-4-6-1024x531.png\" alt=\"Figure 4. Debug Configurations\" width=\"714\" height=\"371\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-4-6-1024x531.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-4-6-300x156.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-4-6-768x399.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-4-6-600x311.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-4-6-1536x797.png 1536w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-4-6-120x62.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-4-6-500x259.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-4-6-200x104.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-4-6-400x208.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-4-6-800x415.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-4-6-1200x623.png 1200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-4-6.png 1875w\" sizes=\"(max-width: 714px) 100vw, 714px\" \/><figcaption id=\"caption-attachment-10032\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 3. Debug Configurations<\/span><\/figcaption><\/figure>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">Now it went to the debug mode, and every time, it asks to Confirm Perspective Switch option. I would select this <\/span><b>Remember my decision<\/b><span style=\"font-weight: 400;\">, and I will click <\/span><b>Switch<\/b><span style=\"font-weight: 400;\"> here.<\/span><\/span><\/p>\n<figure id=\"attachment_10033\" aria-describedby=\"caption-attachment-10033\" style=\"width: 715px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-10033\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/06\/Figure-5-6-1024x524.png\" alt=\"Sizeof testing\" width=\"715\" height=\"366\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-5-6-1024x524.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-5-6-300x154.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-5-6-768x393.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-5-6-600x307.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-5-6-1536x786.png 1536w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-5-6-120x61.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-5-6-500x256.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-5-6-200x102.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-5-6-400x205.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-5-6-800x410.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-5-6-1200x614.png 1200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-5-6.png 1885w\" sizes=\"(max-width: 715px) 100vw, 715px\" \/><figcaption id=\"caption-attachment-10033\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 4. Confirm Perspective Switch<\/span><\/figcaption><\/figure>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">It will appear at the bottom of the SWV ITM Data Console. And then, click on <\/span><b>Configure Trace<\/b><span style=\"font-weight: 400;\"> here,&nbsp; as shown in Figure 5.<\/span><\/span><\/p>\n<figure id=\"attachment_10034\" aria-describedby=\"caption-attachment-10034\" style=\"width: 715px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-10034\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/06\/Figure-6-6-1024x619.png\" alt=\"Sizeof testing\" width=\"715\" height=\"432\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-6-6-1024x619.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-6-6-300x181.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-6-6-768x464.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-6-6-600x363.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-6-6-120x73.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-6-6-500x302.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-6-6-200x121.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-6-6-400x242.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-6-6-800x484.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-6-6-1200x725.png 1200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-6-6.png 1431w\" sizes=\"(max-width: 715px) 100vw, 715px\" \/><figcaption id=\"caption-attachment-10034\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 5. Select Configure Trace<\/span><\/figcaption><\/figure>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">Select <\/span><b>Port 0 here<\/b><span style=\"font-weight: 400;\">, this is also called channel 0 of ITM.&nbsp;<\/span><span style=\"font-weight: 400;\">&nbsp;<\/span><\/span><\/p>\n<figure id=\"attachment_10035\" aria-describedby=\"caption-attachment-10035\" style=\"width: 714px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-10035\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/06\/Figure-7-6-1024x628.png\" alt=\"Sizeof testing\" width=\"714\" height=\"438\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-7-6-1024x628.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-7-6-300x184.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-7-6-768x471.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-7-6-600x368.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-7-6-1536x943.png 1536w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-7-6-120x74.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-7-6-500x307.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-7-6-200x123.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-7-6-400x245.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-7-6-800x491.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-7-6-1200x736.png 1200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-7-6.png 1605w\" sizes=\"(max-width: 714px) 100vw, 714px\" \/><figcaption id=\"caption-attachment-10035\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 6. Serial Wire Viewer settings for 002Sizeof Debug<\/span><\/figcaption><\/figure>\n<p data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Actually, ITM has 32 channels, and our printf works over channel 0. That&#8217;s why we are monitoring channel 0.&nbsp;<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">Channel 1 can be used for other purposes if you use RTOS or something. So, if you want to get the diagnostic information of some other events, then you can use channel 1, channel 2, channel 3 like that. But by default, channel 0 will be used. That&#8217;s why we are monitoring channel 0 here. And then click <\/span><b>OK <\/b><span style=\"font-weight: 400;\">here, as shown in Figure 6.&nbsp;<\/span><\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">After that, click on <\/span><b>Start Trace<\/b><span style=\"font-weight: 400;\">.<\/span><\/span><\/p>\n<figure id=\"attachment_10036\" aria-describedby=\"caption-attachment-10036\" style=\"width: 715px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-10036\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/06\/Figure-8-6-1024x518.png\" alt=\"Sizeof testing\" width=\"715\" height=\"362\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-8-6-1024x518.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-8-6-300x152.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-8-6-768x388.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-8-6-600x303.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-8-6-1536x777.png 1536w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-8-6-120x61.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-8-6-500x253.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-8-6-540x272.png 540w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-8-6-200x101.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-8-6-400x202.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-8-6-800x405.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-8-6-1200x607.png 1200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-8-6.png 1920w\" sizes=\"(max-width: 715px) 100vw, 715px\" \/><figcaption id=\"caption-attachment-10036\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 7. Click on Start Trace<\/span><\/figcaption><\/figure>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000000;\"><span style=\"font-weight: 400;\">And after that, now let&#8217;s use the option that is <\/span><b>Step Over<\/b><span style=\"font-weight: 400;\">, to execute the &#8216;C&#8217; statements one by one.<\/span><\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">Let&#8217;s first click this Step Over. The first line is executed, and in the console, it is printed. The size of the char data type is 1. That&#8217;s correct.&nbsp;<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">And next is short. So, the short is 2. For this cross compiler, the size of an int is 4 bytes, long is 4 bytes, long long is 8 bytes, and double is 8 bytes\u2014the output is shown in Figure 8.<\/span><\/p>\n<figure id=\"attachment_10037\" aria-describedby=\"caption-attachment-10037\" style=\"width: 714px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-10037\" src=\"http:\/\/fastbitlab.com\/wp-content\/uploads\/2022\/06\/Figure-9-6-1024x510.png\" alt=\"Sizeof testing\" width=\"714\" height=\"356\" srcset=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-9-6-1024x510.png 1024w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-9-6-300x149.png 300w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-9-6-768x382.png 768w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-9-6-600x299.png 600w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-9-6-1536x764.png 1536w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-9-6-120x60.png 120w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-9-6-500x249.png 500w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-9-6-200x100.png 200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-9-6-400x199.png 400w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-9-6-800x398.png 800w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-9-6-1200x597.png 1200w, https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-9-6.png 1915w\" sizes=\"(max-width: 714px) 100vw, 714px\" \/><figcaption id=\"caption-attachment-10037\" class=\"wp-caption-text\"><span style=\"color: #000000;\">Figure 8. Output<\/span><\/figcaption><\/figure>\n<p data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px; line-height: 30px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">A simple exercise to find out different data sizes of different standard data types available in &#8216;C&#8217; programming language, and this time we used the cross compiler.<\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-family: 'Roboto Slab'; font-weight: 400; font-size: 17px;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"font-weight: 400; color: #000000;\">In the following article, let&#8217;s explore more about this IDE to browse the memory window, and to understand where exactly the code is stored, and will also analyze some of the disassembly code of our project.&nbsp;<\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<p class=\"\" style=\"border-width: 0px; font-size: 20px; line-height: 26px; font-family: 'Roboto Slab'; font-weight: 400;\" data-font-family=\"Roboto Slab\" data-font-weight=\"400\" data-font-style=\"\"><span style=\"color: #000080;\"><b>FastBit Embedded Brain Academy Courses<\/b><\/span><\/p>\n<p class=\"\" style=\"border-width: 0px; font-size: 17px;\"><span style=\"color: #000000;\">C<span style=\"font-weight: 400;\"><span style=\"color: #000000;\">lick here:<\/span><span style=\"color: #0000ff;\">&nbsp;<\/span><\/span><\/span><span style=\"color: #0000ff;\"><a style=\"color: #0000ff; text-decoration: underline;\" href=\"http:\/\/fastbitlab.com\/course1\" target=\"_blank\" rel=\"noopener\"><span style=\"font-weight: 400;\">https:\/\/fastbitlab.com\/course1<\/span><\/a><\/span><\/p>\n<p class=\"\">&nbsp;<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; Sizeof Operator &nbsp; &nbsp; In this article, we learn about Sizeof operator. Our newly created project, 002Sizeof, employs the powerful printf functionality to display the sizes of various data types.&nbsp; &nbsp; In main.c, first use the header file #include &lt;stdio.h&gt;. After that, let me use printf to print the size of a char data [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":10029,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ocean_post_layout":"","ocean_both_sidebars_style":"","ocean_both_sidebars_content_width":0,"ocean_both_sidebars_sidebars_width":0,"ocean_sidebar":"0","ocean_second_sidebar":"0","ocean_disable_margins":"enable","ocean_add_body_class":"","ocean_shortcode_before_top_bar":"","ocean_shortcode_after_top_bar":"","ocean_shortcode_before_header":"","ocean_shortcode_after_header":"","ocean_has_shortcode":"","ocean_shortcode_after_title":"","ocean_shortcode_before_footer_widgets":"","ocean_shortcode_after_footer_widgets":"","ocean_shortcode_before_footer_bottom":"","ocean_shortcode_after_footer_bottom":"","ocean_display_top_bar":"default","ocean_display_header":"default","ocean_header_style":"","ocean_center_header_left_menu":"0","ocean_custom_header_template":"0","ocean_custom_logo":0,"ocean_custom_retina_logo":0,"ocean_custom_logo_max_width":0,"ocean_custom_logo_tablet_max_width":0,"ocean_custom_logo_mobile_max_width":0,"ocean_custom_logo_max_height":0,"ocean_custom_logo_tablet_max_height":0,"ocean_custom_logo_mobile_max_height":0,"ocean_header_custom_menu":"0","ocean_menu_typo_font_family":"0","ocean_menu_typo_font_subset":"","ocean_menu_typo_font_size":0,"ocean_menu_typo_font_size_tablet":0,"ocean_menu_typo_font_size_mobile":0,"ocean_menu_typo_font_size_unit":"px","ocean_menu_typo_font_weight":"","ocean_menu_typo_font_weight_tablet":"","ocean_menu_typo_font_weight_mobile":"","ocean_menu_typo_transform":"","ocean_menu_typo_transform_tablet":"","ocean_menu_typo_transform_mobile":"","ocean_menu_typo_line_height":0,"ocean_menu_typo_line_height_tablet":0,"ocean_menu_typo_line_height_mobile":0,"ocean_menu_typo_line_height_unit":"","ocean_menu_typo_spacing":0,"ocean_menu_typo_spacing_tablet":0,"ocean_menu_typo_spacing_mobile":0,"ocean_menu_typo_spacing_unit":"","ocean_menu_link_color":"","ocean_menu_link_color_hover":"","ocean_menu_link_color_active":"","ocean_menu_link_background":"","ocean_menu_link_hover_background":"","ocean_menu_link_active_background":"","ocean_menu_social_links_bg":"","ocean_menu_social_hover_links_bg":"","ocean_menu_social_links_color":"","ocean_menu_social_hover_links_color":"","ocean_disable_title":"default","ocean_disable_heading":"default","ocean_post_title":"","ocean_post_subheading":"","ocean_post_title_style":"","ocean_post_title_background_color":"","ocean_post_title_background":0,"ocean_post_title_bg_image_position":"","ocean_post_title_bg_image_attachment":"","ocean_post_title_bg_image_repeat":"","ocean_post_title_bg_image_size":"","ocean_post_title_height":0,"ocean_post_title_bg_overlay":0.5,"ocean_post_title_bg_overlay_color":"","ocean_disable_breadcrumbs":"default","ocean_breadcrumbs_color":"","ocean_breadcrumbs_separator_color":"","ocean_breadcrumbs_links_color":"","ocean_breadcrumbs_links_hover_color":"","ocean_display_footer_widgets":"default","ocean_display_footer_bottom":"default","ocean_custom_footer_template":"0","ocean_post_oembed":"","ocean_post_self_hosted_media":"","ocean_post_video_embed":"","ocean_link_format":"","ocean_link_format_target":"self","ocean_quote_format":"","ocean_quote_format_link":"post","ocean_gallery_link_images":"off","ocean_gallery_id":[],"footnotes":""},"categories":[8],"tags":[16],"class_list":["post-10026","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","tag-microcontroller-embedded-c-programming","entry","has-media"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Using Sizeof Operator in C: Display Sizes of Data Types<\/title>\n<meta name=\"description\" content=\"Sizeof Operator. Explores how to use printf to display the sizes of char, short, int, long, long long, double data types. A step by step guide\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-53-sizeof-operator\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Using Sizeof Operator in C: Display Sizes of Data Types\" \/>\n<meta property=\"og:description\" content=\"Sizeof Operator. Explores how to use printf to display the sizes of char, short, int, long, long long, double data types. A step by step guide\" \/>\n<meta property=\"og:url\" content=\"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-53-sizeof-operator\/\" \/>\n<meta property=\"og:site_name\" content=\"FastBit EBA\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/fastbiteba\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-07-01T04:56:09+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-08-26T10:12:10+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-1-8.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1869\" \/>\n\t<meta property=\"og:image:height\" content=\"1017\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"FastBitLab\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@fastbiteba\" \/>\n<meta name=\"twitter:site\" content=\"@fastbiteba\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"FastBitLab\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-53-sizeof-operator\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-53-sizeof-operator\\\/\"},\"author\":{\"name\":\"FastBitLab\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/person\\\/e32b38e733a0d76ffa7e6bc998652e5d\"},\"headline\":\"Microcontroller Embedded C Programming Lecture 53 | Sizeof testing\",\"datePublished\":\"2022-07-01T04:56:09+00:00\",\"dateModified\":\"2023-08-26T10:12:10+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-53-sizeof-operator\\\/\"},\"wordCount\":700,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-53-sizeof-operator\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/Figure-1-8.png\",\"keywords\":[\"Microcontroller Embedded C programming Lectures\"],\"articleSection\":[\"Blog\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-53-sizeof-operator\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-53-sizeof-operator\\\/\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-53-sizeof-operator\\\/\",\"name\":\"Using Sizeof Operator in C: Display Sizes of Data Types\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-53-sizeof-operator\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-53-sizeof-operator\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/Figure-1-8.png\",\"datePublished\":\"2022-07-01T04:56:09+00:00\",\"dateModified\":\"2023-08-26T10:12:10+00:00\",\"description\":\"Sizeof Operator. Explores how to use printf to display the sizes of char, short, int, long, long long, double data types. A step by step guide\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-53-sizeof-operator\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-53-sizeof-operator\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-53-sizeof-operator\\\/#primaryimage\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/Figure-1-8.png\",\"contentUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/Figure-1-8.png\",\"width\":1869,\"height\":1017,\"caption\":\"Figure 1. 002Sizeof project\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/microcontroller-embedded-c-programming-lecture-53-sizeof-operator\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Microcontroller Embedded C Programming Lecture 53 | Sizeof testing\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/\",\"name\":\"FastBit EBA\",\"description\":\"Your Online Academy of Embedded Systems\",\"publisher\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#organization\",\"name\":\"FastBit EBA\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/logo-EzNrEnyr.png\",\"contentUrl\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/04\\\/logo-EzNrEnyr.png\",\"width\":640,\"height\":640,\"caption\":\"FastBit EBA\"},\"image\":{\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/fastbiteba\\\/\",\"https:\\\/\\\/x.com\\\/fastbiteba\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/fastbit-embedded-brain-academy-b3167b124\\\/\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCa1REBV9hyrzGp2mjJCagBg\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/fastbitlab.com\\\/blog\\\/#\\\/schema\\\/person\\\/e32b38e733a0d76ffa7e6bc998652e5d\",\"name\":\"FastBitLab\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g\",\"caption\":\"FastBitLab\"},\"description\":\"The FastBit Embedded Brain Academy uses the power of internet to bring the online courses related to the field of embedded system programming, Real time operating system, Embedded Linux systems, etc at your finger tip with very low cost. Backed with strong experience of industry, we have produced lots of courses with the customer enrolment over 3000+ across 100+ countries.\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Using Sizeof Operator in C: Display Sizes of Data Types","description":"Sizeof Operator. Explores how to use printf to display the sizes of char, short, int, long, long long, double data types. A step by step guide","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-53-sizeof-operator\/","og_locale":"en_US","og_type":"article","og_title":"Using Sizeof Operator in C: Display Sizes of Data Types","og_description":"Sizeof Operator. Explores how to use printf to display the sizes of char, short, int, long, long long, double data types. A step by step guide","og_url":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-53-sizeof-operator\/","og_site_name":"FastBit EBA","article_publisher":"https:\/\/www.facebook.com\/fastbiteba\/","article_published_time":"2022-07-01T04:56:09+00:00","article_modified_time":"2023-08-26T10:12:10+00:00","og_image":[{"width":1869,"height":1017,"url":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-1-8.png","type":"image\/png"}],"author":"FastBitLab","twitter_card":"summary_large_image","twitter_creator":"@fastbiteba","twitter_site":"@fastbiteba","twitter_misc":{"Written by":"FastBitLab","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-53-sizeof-operator\/#article","isPartOf":{"@id":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-53-sizeof-operator\/"},"author":{"name":"FastBitLab","@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/person\/e32b38e733a0d76ffa7e6bc998652e5d"},"headline":"Microcontroller Embedded C Programming Lecture 53 | Sizeof testing","datePublished":"2022-07-01T04:56:09+00:00","dateModified":"2023-08-26T10:12:10+00:00","mainEntityOfPage":{"@id":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-53-sizeof-operator\/"},"wordCount":700,"commentCount":0,"publisher":{"@id":"https:\/\/fastbitlab.com\/blog\/#organization"},"image":{"@id":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-53-sizeof-operator\/#primaryimage"},"thumbnailUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-1-8.png","keywords":["Microcontroller Embedded C programming Lectures"],"articleSection":["Blog"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-53-sizeof-operator\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-53-sizeof-operator\/","url":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-53-sizeof-operator\/","name":"Using Sizeof Operator in C: Display Sizes of Data Types","isPartOf":{"@id":"https:\/\/fastbitlab.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-53-sizeof-operator\/#primaryimage"},"image":{"@id":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-53-sizeof-operator\/#primaryimage"},"thumbnailUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-1-8.png","datePublished":"2022-07-01T04:56:09+00:00","dateModified":"2023-08-26T10:12:10+00:00","description":"Sizeof Operator. Explores how to use printf to display the sizes of char, short, int, long, long long, double data types. A step by step guide","breadcrumb":{"@id":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-53-sizeof-operator\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-53-sizeof-operator\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-53-sizeof-operator\/#primaryimage","url":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-1-8.png","contentUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2022\/06\/Figure-1-8.png","width":1869,"height":1017,"caption":"Figure 1. 002Sizeof project"},{"@type":"BreadcrumbList","@id":"https:\/\/fastbitlab.com\/blog\/microcontroller-embedded-c-programming-lecture-53-sizeof-operator\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/fastbitlab.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Microcontroller Embedded C Programming Lecture 53 | Sizeof testing"}]},{"@type":"WebSite","@id":"https:\/\/fastbitlab.com\/blog\/#website","url":"https:\/\/fastbitlab.com\/blog\/","name":"FastBit EBA","description":"Your Online Academy of Embedded Systems","publisher":{"@id":"https:\/\/fastbitlab.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/fastbitlab.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/fastbitlab.com\/blog\/#organization","name":"FastBit EBA","url":"https:\/\/fastbitlab.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2026\/04\/logo-EzNrEnyr.png","contentUrl":"https:\/\/fastbitlab.com\/blog\/wp-content\/uploads\/2026\/04\/logo-EzNrEnyr.png","width":640,"height":640,"caption":"FastBit EBA"},"image":{"@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/fastbiteba\/","https:\/\/x.com\/fastbiteba","https:\/\/www.linkedin.com\/in\/fastbit-embedded-brain-academy-b3167b124\/","https:\/\/www.youtube.com\/channel\/UCa1REBV9hyrzGp2mjJCagBg"]},{"@type":"Person","@id":"https:\/\/fastbitlab.com\/blog\/#\/schema\/person\/e32b38e733a0d76ffa7e6bc998652e5d","name":"FastBitLab","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/9230d0f9bdef28b63a01e7ca274ee7b2e8ed9abe932ee564af8809caaf52a0c8?s=96&d=mm&r=g","caption":"FastBitLab"},"description":"The FastBit Embedded Brain Academy uses the power of internet to bring the online courses related to the field of embedded system programming, Real time operating system, Embedded Linux systems, etc at your finger tip with very low cost. Backed with strong experience of industry, we have produced lots of courses with the customer enrolment over 3000+ across 100+ countries."}]}},"_links":{"self":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts\/10026","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/comments?post=10026"}],"version-history":[{"count":5,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts\/10026\/revisions"}],"predecessor-version":[{"id":15624,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/posts\/10026\/revisions\/15624"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/media\/10029"}],"wp:attachment":[{"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/media?parent=10026"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/categories?post=10026"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fastbitlab.com\/blog\/wp-json\/wp\/v2\/tags?post=10026"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}