Data Types





C language is rich in its data type.

Data type tells the type of data, that you are going to store in memory.

It gives the information to compiler that how much memory ( No. of bytes ) will be stored by the data.


I. Primitive Data Types :

TypeSizeDescription
char1 byteUsed for characters or integer variables.
int2 or 4 bytesUsed for integer values.
float4 bytesSingle precision floating point values.
double8 bytesDouble precision floating point values.

In addition to these data types, some of them may be used with a modifier that affects the characteristics of the data object. These modifiers are listed in Table.

Modifiers :

ModifierDescription
longForces a type int to be 4 bytes (32 bits) long and forces a type double to be larger than a double (but the actual size is implementation defined). Cannot be used with short.
shortForces a type int to be 2 bytes (16 bits) long. Cannot be used with long.
unsignedCauses the compiler (and CPU) to treat the number as containing only positive values. Because a 16-bit signed integer can hold values between – 32,768 and 32,767, an unsigned integer can hold values between 0 and 65,535. The unsigned modifier can be used with char, long, and short (integer) types.

The essence of all the data types that we have learnt so far has been captured in Table.

Data TypeRangeBytesFormat Specifier
signed char-128 to +1271%c
unsigned char0 to 2551%c
short signed int-32768 to +327672%d
short unsigned int0 to 655352%u
signed int-32768 to +327672%d
unsigned int0 to 655352%u
long signed int-2147483648 to +21474836474%ld
long unsigned int0 to +42949672954%lu
float-3.4e38 to +3.4e384%f
double-1.7e308 to +1.7e3088%lf
long double-1.7e4932 to +1.7e493210%LF

NOTE : The sizes and ranges of int, short and long are compiler dependent.Sizes in above table are for 16-bit compiler.


II. Derived Data Types :


III. User Defined Data Types :

Next topic is keywords






 





Training For College Campus

We offers college campus training for all streams like CS, IT, ECE, Mechanical, Civil etc. on different technologies like
C, C++, Data Structure, Core Java, Advance Java, Struts Framework, Hibernate, Python, Android, Big-Data, Ebedded & Robotics etc.

Please mail your requirement at info@prowessapps.in


Projects For Students

Students can contact us for their projects on different technologies Core Java, Advance Java, Android etc.

Students can mail requirement at info@prowessapps.in



CONTACT DETAILS

info@prowessapps.in
(8AM to 10PM):

+91-9026070669 , +91-9451396824

© 2016, prowessapps.in, All rights reserved