C Program Learning Part-2
CONSTANTS, VARIABLES AND DATA TYPES
CHARACTER SET
1. Letters
2. Digits
3. Special Characters
4. White Space
C TOKENS
In a passage of text, individual words and punctuation marks are called tokens. In C program the smallest individual units are known as C tokens. Six types of C tokens are used to write program and syntax of the language.
C TOKENS
Keywords - float, while
Constants - 15.5, 200
Special Symbols - {}, []
Identifiers - main, amount
Strings - “ABC”, “YEAR”
Operators - +, -, *, /
Keywords and Identifiers
Keywords
*Fixed meaning and can not be changed.
*Basic building block for program statement.
ANSI C Keyword
auto |
double |
int |
struct |
break |
else |
long |
switch |
case |
enum |
register |
typedef |
char |
extern |
return |
union |
const |
for |
signed |
void |
continue |
float |
short |
unsigned |
default |
goto |
sizeof |
volatile |
do |
if |
static |
while |
Identifiers
Rules for Identifiers
Variables
Conditions of Variables
Primary Data Type |
|||
Signed |
Range |
Unsigned |
Range |
int or signed int (16 bit) |
-32768 to 32767 |
unsigned int (16 bit) |
0 to 65535 |
short int or signed short int
(8 bit) |
-128 to 127 |
unsigned int (8 bit) |
0 to 255 |
long int or signed long int
(32bit) |
-214,74,83,648 to 214,74,83,647 |
unsigned long int (32 bit) |
0 to 4294967295 |
float (32 bit) |
3.4E-38 to 3.4E+38 |
double (64 bit) |
1.7E-308 to 1.7E+308 |
long double (80 bit) |
3.4E-4932 to 1.1E+4932 |
|
|
char or signed 1/2/2020 char (8
bit) |
-128 to 127 |
unsigned char (8 bit) |
0 to 255 |