Size of int is 2 or 4 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Size of int is 2 or 4

C programming

9th Feb 2020, 4:04 AM
ARAVINDH
ARAVINDH - avatar
3 Answers
+ 3
It depends. Run this code to be sure: printf("%d",(int)sizeof(int));
9th Feb 2020, 4:13 AM
Kevin ★
+ 2
ARAVINDH ARAVINDH size of int is compiler dependent or more appropriately processor dependent. If you are using a 16bit machine than it is 2 Bytes If you are using a 32 or 64 bit machine than it is 4 bytes. Best way is to use sizeof(int) to find the actual size on your system
9th Feb 2020, 4:14 AM
Arsenic
Arsenic - avatar
+ 2
It depends kn complier. You can check it by using sizeof(int).
9th Feb 2020, 9:01 AM
Mehak Jain