Microcontroller Embedded C Programming Lecture 52| Run Sizeof on Embedded Target

 

Run Sizeof on Embedded Target

 

 

In this article,  let’s do one more exercise on our Embedded Target. By using the sizeof operator, find out the storage sizes of the below data types for your cross compiler.

Run Sizeof on Embedded Target
Figure 1. Exercise

 

We actually did the same thing in the earlier part of the article sizeof, where we used the sizeof operator on our machine to print out the data size values for the various standard data types available in ‘C.’ 

Same thing you have to do, but in this case, you have to do it for Embedded Target. After that, you can use the printf statement to print the result something similar to this.

 

You can create a new project. But, whenever you create a new project you would have observed here, the IDE actually creates the main function, and it adds for(;;); this statement at the end of the main function. This is called ‘C’s loop statement. 

Run Sizeof on Embedded Target
Figure 2. for loop

 

Please note that this is a for loop, and this is an implementation of the infinite loop. When the execution control reaches here, the processor actually hangs here, executing this infinite loop. 

Why is it required?

We will explore that in the following article. So, keep this for loop at the end of the main function.

 

FastBit Embedded Brain Academy Courses

Click here: https://fastbitlab.com/course1

 

FastBitLab

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.