no matter how much u increase ur int value data type type will return same value | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

no matter how much u increase ur int value data type type will return same value

e.g if u int=4; char size will be 1 if int=4444444; char size will be still 1...why is that?

25th Dec 2016, 12:57 PM
Aqib Asmat
Aqib Asmat - avatar
1 Answer
+ 1
The int type (and all primitive types in C++) have a fixed width. This width is primarily determined by the architecture of the computer. It doesn't matter how big or small of a value you put in to any of the primitive types, it will remain the same size and take up the same space in memory. You will need to be careful however as this means that these variables have limits to how large of a value you can store in then before they overflow.
25th Dec 2016, 2:52 PM
James Durand
James Durand - avatar