- This topic has 1 reply, 2 voices, and was last updated 6 years, 6 months ago by .
Viewing 2 posts - 1 through 2 (of 2 total)
Viewing 2 posts - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.
|
Microcontroller › PIC › Is that integer size would be differ for every 16bit,32bit controller
Int x;
Is that now x will occupy different size in 16 bit,32 bit ??
Then what about the short int, long int,double, — All vary on architecture of controller ??
If we need to perform some 32 bit operations in 16 bit controller, how to do ??
i think int take a single word size of the controller(if 8 bit — 8, 16 bit — 16 bit),
I am so confused. kindly answer me with clear data(if possible example)
Thanks in Advance
Gokul
Hi
While coding if you make use of an integer variable then it's size will remain fixed, it will not change according to the microcontroller you use. Generally an unsigned it in allocated 4 bytes but what if you do not want that much space, well there is a provision in coding language to change the size of integer variable as per your requirements.
So If you want to store values in integer variable upto 8 bits you can initialize your variable by writing uint_8t variable_name. Similarly for for 16,32 and 64 bit variable you will initialize variable like: uint_16t, uint_32t and uint_64t respectively. For signed integer variables you can omit u in the begining.