Você está na página 1de 18

Character Set Consists Of -

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
No Token Type Example 1 Example 2

1 Keyword do while

2 Constants number sum

3 Identifier -76 89

4 String “HTF” “PRIT”

Special
5 * @
Symbol

6 Operators ++ /
Basic Building Blocks and Definition :

Token Meaning

All keywords have fixed meaning and these meanings cannot be


Keyword
changed . Eg. Break, if , while, case

Constant Constants are expressions with a fixed value eg. 25, -12.3

The term identifier is usually used for variable names , functions and
Identifier
arrays. Eg. Amount, main
String Sequence of characters eg. “abc” , “hello”

Special Symbol Symbols other than the Alphabets and Digits and white-spaces eg. {}, []

A symbol that represent a specific mathematical or non mathematical


Operators
action eg. ,-,*,/
Keywords in C Programming Language :

Keywords are those words whose meaning is already defined


by Compiler
Cannot be used as Variable Name

There are 32 Keywords in C

C Keywords are also called as Reserved words .


32 Keywords in C Programming
Language

auto double int struct


break else long switch
case enum register typedef
char extern return union
const float short unsigned
continue for signed void
default goto sizeof volatile
do if static while

We cannot Use Keywords for – For Declaring Variable Name,For


Function Name and for declaring Constant Variable
Constant

Constant in C means the content whose value does not change at


the time of execution of a program.

CONSTANTS

NUMERIC CHARACTER
CONSTANTS CONSTANTS

REAL CONSTANTS
INTEGER SINGLE CHARACTER STRING
OR FLOATING
CONSTANTS CONSTANTS CONSTANTS
POINT CONSTANT
INTEGER
CONSTANT

DECIMAL OCTAL
HEXA DECIMAL
INTEGER eg. INTEGER
INTEGER eg.
123, - eg.037,0,0435,
0x2,0x9F
321,0,+78 0551
REAL OR
FLOATING
POINT
CONSTANT

SINGLE PRECISION DOUBLE PRECISION


CONSTANT eg.(64
CONSTANT eg.3E2 (32
bit number with
bit number with 6 more than 14
precision ) digits of precision)

Real Number Representation


4567.45 4.56745e3
0.00045 4.5e-4
Single Character Constant :

Character Constant Can hold Single character at a time.

Contains Single Character Closed within a pair of Single Quote Marks

Single Character is smallest Character Data Type in C.

Integer Representation : Character Constant have Integer Value known as


‘ASCII’ value

It is Possible to Perform Arithmetic Operations on Character Constants

Examples of character Type :


‘a’
’1′
‘#’
‘<’
‘X’
String Constant

String is “Sequence of Characters“.

String Constant is written in Pair of Double Quotes.

String is declared as Array of Characters.

In C , String data type is not available.

Single Character String Does not have Equivalent Integer Value


i.e ASCII Value
Example Meaning
String with Single
“a”
Character
String With Multiple
“Ali”
Characters
“123? String With Digits
“How are You” String With Blanks
Special Backslash Character Constants in C :

The characters which are represented using backslash are known as


escape sequences. Escape sequence may be i)non printable characters
and ii) printable characters .The escape sequences that are non-printable
are known as non-graphic character and printable are known as printable
characters0
Constant Meaning
‘a’ Audible Alert (Bell)
‘b’ Back Space
‘f’ Form Feed
‘n’ New Line
‘r’ Carriage Return
‘t’ Horizontal Tab
‘v’ Vertical Tab
”’ Single Quote
‘”‘ Double Quote
‘?’ Question Mark
‘\’ Backslash
‘\0′ Null
Tab : ‘\t’ Character
•It is Horizontal Tab r

#include<stdio.h>
#include?<conio.h>
void main()
{
printf("Hello\t");
printf(“how are you”);
getch();
}
Variable

A Variable is a name given to the memory location where the


actual data is stored.

Variable in C Programming is also called as container to


store the data
Variable is considered as one of the building block of C
Programming which is also called as identifier.
Its vlaue changes during the execution of the program.
Rules For Constructing Variable Name

Characters Allowed :
Underscore(_)
Capital Letters ( A – Z )
Small Letters ( a – z )
Digits ( 0 – 9 )

Blanks & Commas are not allowed

No Special Symbols other than underscore(_) are allowed

First Character should be alphabet or Underscore

Variable name Should not be Reserved Word


Data Type in C

Data type is the term used to refer to kind of data


stored in the program.

DATA TYPES IN C

USER
PRIMARY OR DERIVED
DEFINED
FUNDAMENTAL DATA TYPE
DATA TYPE
PRIMARY DATA TYPE

INTEGER
SIGNED UNSIGNED CHARACTER

int unsigned int Char

Short int unsigned short int Signed char

Long int unsigned long int Unsigned char

FLOATING POINT TYPE


float double long double void
Data Type keyword Description
Integer Data Stores the
int
Type Integer Value
Stores the
Float Data Type float Floating Point
Value
Stores the
Character Data
char Single Character
Type
Value
Stores the Long
Long Data Type long range Integer
Value
Stores the long
Double Data
double range Floating
Type
V

Você também pode gostar