14. C Keywords, Datatypes - short, long and double | Assembly, C on Bare-metal RISC-V

preview_player
Показать описание

𝗖𝗼𝗿𝗿𝗲𝗰𝘁𝗶𝗼𝗻: The Mantissa in double is 52 bits wide, not 53 :)

𝗜𝗻 𝘁𝗵𝗶𝘀 𝗩𝗶𝗱𝗲𝗼: This video is about C keywords and data types, specifically short, long, and double. I explain how these data types are stored in memory and how they are used in C code.

We start by reviewing what was covered in the previous video, which was about character, integer, and float data types. Then, we move on to discuss short, long, and double data types.

I also talk about how these data types are stored in memory on a 32-bit RISC-V machine. For example, a long long integer is actually stored in two registers, because a single register is only 4 bytes wide. I then show how these data types are used in C code by compiling a simple program and looking at the assembly code that is generated. This helps to illustrate how the C code is translated into machine code that the computer can understand.

Here are some key takeaways from the video:

- Short, long, and double are data types in C that are used to store different types of numbers.
- Short integers are 2 bytes, long integers are 4 bytes, and double-precision floating-point numbers are 8 bytes.
- The way data types are stored in memory can affect how they are used in C code.
- Experimenting with different data types is a great way to learn more about how C code works.

𝗖𝗵𝗮𝗽𝘁𝗲𝗿𝘀: TODO

Want to try it yourself? Use the following resources/guide -
𝗟𝗮𝗯 𝗦𝗲𝘁𝘂𝗽 -
𝗗𝗼𝗰𝗸𝗲𝗿 𝗦𝗲𝘁𝘂𝗽:

𝙈𝙚𝙢𝙚𝙗𝙚𝙧𝙨:

#inpyjama #cninja #embeddedsystems #embedded #clanguage #arm #riscv
Рекомендации по теме
Комментарии
Автор

Thank you, keeping the session to 35 to 40 mins is perfect. 28:00 int b is stored in offsets 21 to 24. In which offsets will the most significant byte and least significant byte be stored? I think endianness of the CPU architecture plays a role here.

donythomas
Автор

So good... both concept and explanation. Didn't find this in any books, website I have read till date.

saitarun