DATA TYPES.pdf
Document Details
Uploaded by TenaciousMridangam9688
Tags
Full Transcript
DATA TYPES 1. Integer Types Format Format Size (in Data Type Range (Signed) Range (Unsigned) S...
DATA TYPES 1. Integer Types Format Format Size (in Data Type Range (Signed) Range (Unsigned) Specifier Specifier bytes) (Signed) (Unsigned) int 4 -2,147,483,648 to 2,147,483,647 0 to 4,294,967,295 %d %u short int 2 -32,768 to 32,767 0 to 65,535 %hd %hu 8 (4 on -9,223,372,036,854,775,808 to 0 to long int %ld %lu 32-bit) 9,223,372,036,854,775,807 18,446,744,073,709,551,615 long long -9,223,372,036,854,775,808 to 0 to 8 %lld %llu int 9,223,372,036,854,775,807 18,446,744,073,709,551,615 unsigned 4 N/A 0 to 4,294,967,295 N/A %u int 2. Floating-Point Types Data Type Size (in bytes) Range Precision Format Specifier float 4 3.4E-38 to 3.4E+38 6 decimal places %f double 8 1.7E-308 to 1.7E+308 15 decimal places %lf long double 16 3.4E-4932 to 1.1E+4932 18 decimal places %Lf 3. Character Types Data Type Size (in bytes) Range (Signed) Range (Unsigned) Format Specifier char 1 -128 to 127 0 to 255 %c unsigned char 1 N/A 0 to 255 %c Summary of Format Specifiers: Integer: %d, %i (signed), %u (unsigned) Floating-point: %f, %e (scientific), %g (shorter of %e or %f) Character: %c String: %s