0% found this document useful (0 votes)
2 views

primary Data types

C programming language supports three classes of data types: primary, derived, and user-defined. The primary data types include integers, floating points, characters, double-precision floating points, and void, each with specific storage requirements and characteristics. Integers can be signed or unsigned, floating points can be represented as float or double for varying precision, and characters are stored as single bytes with signed or unsigned qualifiers.

Uploaded by

lekshminairms9
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

primary Data types

C programming language supports three classes of data types: primary, derived, and user-defined. The primary data types include integers, floating points, characters, double-precision floating points, and void, each with specific storage requirements and characteristics. Integers can be signed or unsigned, floating points can be represented as float or double for varying precision, and characters are stored as single bytes with signed or unsigned qualifiers.

Uploaded by

lekshminairms9
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Data types

C supports three classes of data types:


1. Primary (or fundamental) data types
2. Derived data types
3. User-defined data types

Primary (or fundamental) data types

Five fundamental data types, namely


1. integer (int)
2. floating point (float)
3. character (char),
4. double-precision floating point (double)
5. void.

Int
Integers are whole numbers. Short int represents fairly small integer values and requires half the
amount of storage as a regular int number
uses. Unlike signed integers, unsigned
integers use all the bits for the magnitude
of the number and are always positive. We
declare long and unsigned integers to
increase the range of values. The use of
qualifier signed on integers is optional
because the default declaration assumes a
signed number. Eg) int a; long int a;
unsigned int a;
Float
Floating point (or real)
numbers are stored in 32 bits
with 6 digits of precision.
Floating point numbers are
defined in C by the keyword
float. When the accuracy
provided by a float number is
not sufficient, the type double can be used to define the number. A double data type number uses
64 bits giving a precision of 14 digits. These are known as double precision numbers. Double type
represents the same data type that float represents, but with a greater precision. To extend the
precision further, we may use long double which uses 80 bits. Eg) float x; double x; long dpuble x;

Void Types
The void type has no values. This is usually used to specify the type of functions. The type of a
function is said to be void when it does not return any value to the calling function. It can also play
the role of a generic type, meaning that it can represent any of the other standard types.

Character Types
A single character can be defined as a character(char) type data. Characters are usually stored in 8
bits (one byte) of internal storage. The qualifier signed or unsigned may be explicitly applied to
char. While unsigned chars have values between 0 and 255, signed chars have values from –128
to 127.
Eg) char y;

You might also like