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

Lecture 5,6 Escape Charecters and Data Types in C

C language notes

Uploaded by

skc722768
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Lecture 5,6 Escape Charecters and Data Types in C

C language notes

Uploaded by

skc722768
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

ESCAPE SEQUENCES

and
Data Types in C

Dr AmitSharma
Santosh Yadav
ESCAPE SEQUENCES
• Special backslash
character constants
are denoted by
backslash followed
by a particular
character. These
combinations of
two characters are
called escape
sequences.
• All escape
sequences begin
with a backslash.
Data Types In C Language
• Each variable in C has an associated data type.
• It specifies the type of data that the variable can store like
integer, character, floating, double, etc.
• Each data type requires different amounts of memory and has
some specific operations which can be performed over it.
• The data type is a collection of data with values having fixed
values, meaning as well as its characteristics.
Data
types
along
with their
size
required
in
memory
Integer Data Type
• The integer datatype in C is used to store the whole numbers
without decimal values.
• Octal values, hexadecimal values, and decimal values can be
stored in int data type in C.
• Range: -2,147,483,648 to 2,147,483,647
• Size: 4 bytes
• Format Specifier: %d
• Syntax of Integer
The integer data type can also be used
as
1.unsigned int: Unsigned int data type in C is used to store the
data values from zero to positive numbers but it can’t store
negative values like signed int.
2.short int: It is lesser in size than the int by 2 bytes so can only
store values from –32,768 to 32,767.
3.long int: Larger version of the int datatype so can store values
greater than int.
4.unsigned short int: Similar in relationship with short int as
unsigned int with int.
Example
Character Data Type
• Character data type allows its variable to store only a single
character. The size of the character is 1 byte. It is the most
basic data type in C. It stores a single character and requires a
single byte of memory in almost all compilers.
• Range: (-128 to 127) or (0 to 255)
• Size: 1 byte
• Format Specifier: %c
• Syntax of char
Example
Float Data Type
• In C programming float data type is used to store floating-
point values. Float in C is used to store decimal and
exponential values. It is used to store decimal numbers
(numbers with floating point values) with single precision.
• Range: 1.2E-38 to 3.4E+38
• Size: 4 bytes
• Format Specifier: %f
• Syntax of float
Example
Double Data Type
• A Double data type in C is used to store decimal numbers (numbers
with floating point values) with double precision.
• The double data type is basically a precision sort of data type that is
capable of holding 64 bits of decimal numbers or floating points.
• It occupies twice the memory occupied by the floating-point type.
• It can easily accommodate about 16 to 17 digits after or before a
decimal point.
• Range: 1.7E-308 to 1.7E+308
• Size: 8 bytes
• Format Specifier: %lf
Example
Size of Data Types in C
• The size of the data types in C is dependent on the size of the
architecture, so we cannot define the universal size of the data
types.
• For that, the C language provides the sizeof() operator to check
the size of the data types.
Example

You might also like