Why java takes 4 byte of int while c has 2?

Java

1 answer

Answer

1125734

2026-04-19 00:25

+ Follow

Java
Java

Java defined int as a 32-bit number because that is generally large enough to hold the information you need.

The size of an int in C may actually have either 16 or 32 bits, depending on the implementation. Basically, the specifications for any C implementation in UNIX must have 32-bit ints, while the ISO C standard only requires 16-bit ints. The stdint.h and limits.h files exist exactly because not all implementations are the same, and these files will define the min/max values of the integral types.

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.