Is size of data type, differ from 32- bit and 64- bit system? In C | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 3

Is size of data type, differ from 32- bit and 64- bit system? In C

If yes means, please explain why?

22nd Oct 2020, 7:48 AM
Yogeshwaran P
Yogeshwaran P - avatar
2 Réponses
+ 5
Not always, you can have two 32 bit compilers having size of *int* as 2 bytes or 4 bytes. it depends on the compiler and how it is implemented. The standard only guarantees that an int will be at least 2 bytes. The size of an int is not always identical to the word size of the target CPU. The size of an int is defined by the compiler implementation, not by the hardware or whether you’re building for 32-bit vs. 64-bit. so the best way to find the size of different data types is using the "sizeof()" operator Source : https://www.quora.com/In-C-language-the-integer-takes-2-bytes-for-a-32-bit-compiler-and-4-bytes-for-a-64-bit-compiler-The-float-always-takes-4-bytes-The-character-always-takes-1-byte-So-why-is-there-only-variation-in-the-case-of-integers
22nd Oct 2020, 8:03 AM
Arsenic
Arsenic - avatar
+ 2
Thank you so much Arsenic 😊
22nd Oct 2020, 8:20 AM
Yogeshwaran P
Yogeshwaran P - avatar