Showing posts with label Tokens of C language. Show all posts
Showing posts with label Tokens of C language. Show all posts

Tuesday, November 07, 2017

Data Types in C

Data Types in C:

Types
Data Types
Basic Data Type
int, char, float, double
Derived Data Type
array, pointer, structure, union
Enumeration Data Type
Enum
Void Data Type
Void

A data type specifies the type of data that a variable can store such as integer, floating, character etc. There are 4 types of data types in C language.

1.7.1. Basic Data Types:


            The basic data types are integer-based and floating-point based. These are also called as scalar data types. C language supports both signed and unsigned literals. The memory size of basic data types may change according to 32 or 64 bit operating system. Let's see the basic data types. It size is given according to 32 bit OS.

Data Types
Memory Size
Range
Data Types

Memory       Size
Range
Char
1 byte
−128 to 127
short int
2 byte
−32,768 to 32,767
signed char
1 byte
−128 to 127
signed short int
2 byte
−32,768 to 32,767
unsigned char
1 byte
0 to 255
unsigned short int
2 byte
0 to 65,535
Short
2 byte
−32,768 to 32,767
long int
4 byte
−2147483647 to +2147483647
signed short
2 byte
−32,768 to 32,767
signed long int
4 byte
−2147483647
to +2147483647
unsigned short
2 byte
0 to 65,535
unsigned long int
4 byte
0 to 4294967294
Int
2 byte
−32,768 to 32,767
float
4 byte
1.2E-38 to 3.4E+38
signed int
2 byte
−32,768 to 32,767
double
8 byte
2.3E-308 to 1.7E+308
unsigned int
2 byte
0 to 65,535
long double
10 byte
3.4E-4932 to 1.1E+4932
Remaining data types will be studied later.

Tokens of C language

Tokens in C:

¾     C tokens are the basic buildings blocks in C language which are constructed together to write a C program.
¾     Each and every smallest individual units in a C program are known as C tokens.
¾     C tokens are of six types. They are,

     1.      Character sets
2.      Keywords
3.      Identifiers
4.      Constants and Variables
5.      Strings
6.      Operators

1. Character sets

¾     The character set of any programming language indicates the different characters the program can contain.
¾     Character set includes all the alphabets, digits and special symbols supported by the processor.
¾     When we will be writing C programs, all these will be found in our program.

¾     Each of these special symbols may have some significance which will be discussed in the forthcoming chapters.
Types
Character Set
Lowercase Letters
a-z
Uppercase Letters
A to Z
Digits
0-9
Special Characters
!@#$%^&*
White Spaces
Tab Or New line Or Space

 Valid C Characters: Special Characters are listed below

Symbol
Meaning
Symbol
Meaning
Symbol
Meaning
~
Tilde
_
Underscore
]
Right bracket
!
Exclamation mark
+
Plus sign
:
Colon
#
Number sign
|
Vertical bar
Quotation mark
$
Dollar sign
\
Backslash
;
Semicolon
%
Percent sign
`
Apostrophe
< 
Opening angle bracket
^
Caret
Minus sign
> 
Closing angle bracket
&
Ampersand
=
Equal to sign
?
Question mark
*
Asterisk
{
Left brace
,
Comma
(
Left parenthesis
}
Right brace
.
Period
)
Right parenthesis
[
Left bracket
/
Slash