why float and int data types have different size ranges while they both need same number of bytes?

float and int not necessarily takes same size as datatypes. its architecture dependent. int take 2 bytes and 4 bytes, depends on architecture and compiler as well.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.