Hii my question is how do we decide when to use which type of datatype
For eg in some program
we get int i, whereas in some programs it is float i, whereas in other programs it is double i....so how do we know which datatype to use...I am confused between int....long ...double.???

Hi mate

choosing ur data type is mostly depends on the value or data that the variable holds. every data type got certain range for it if the value of the variable exceeds the range it returns some garbage.

Hii my question is how do we decide when to use which type of datatype
For eg in some program
we get int i, whereas in some programs it is float i, whereas in other programs it is double i....so how do we know which datatype to use...I am confused between int....long ...double.???

int is used when the number is between 32,000 and -32,000.
float is used when the number involves decimal point.
double is used for larger numbers..eg.1000000000000000000

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.