Why data type size is differ in C and Java ?? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 2

Why data type size is differ in C and Java ??

in C int=2byte In Java Int=4bhte why...?

4th Sep 2017, 8:51 PM
Mohit thakor
Mohit thakor - avatar
1 Resposta
+ 3
It must be due to java running on a virtual machine. In Java, all data types (and every thing in fact) depends of the Java Virtual Machine (JVM) and not of the computer that run this JVM, so data size is fixed. In C, data types are dependant of the computer that run them, and more specifically the compiler that you use, so it can change from one computer to another
4th Sep 2017, 8:58 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar