SlideShare una empresa de Scribd logo
1 de 30
C Token’s
TARUN SHARMA
LECTURER (COMPUTER SCIENCE)
Character Sets
A character refers to the digit, alphabet or special symbol used to data representation.
1. Alphabets : A-Z, a-z
2. Digits : 0-9
3. Special Characters: ~! @ # $ % ^ & * ( ) _ + { } [ ] - <> , . / ?  | : ; " '
4. White Spaces : Horizontal tab, Carriage return, New line, form feed
T A R U N S H A R M A 2
Token’s
C tokens are the basic buildings blocks in C language which are constructed together to write a C
program. Each and every smallest individual unit in a C program is known as C tokens. C has five
types of tokens:
1. Keywords
2. Identifiers
3. Constants
4. Separators
5. Operators
T A R U N S H A R M A 3
For Example:
 main – identifier
 {,}, (,) – separator
 int – keyword
 x, y, total – identifier
 main, {, }, (, ), int, x, y, total – tokens
T A R U N S H A R M A 4
Keywords
All keywords have fixed meaning & there meanings cannot be changed during the execution of a
program. Keywords served as basic building block for program statements. White spaces are not
allowed in keywords. Keywords may not be used as an identifier. ‘C’ has 32 keywords, all
keywords written in lower case. For example, if, int, for, float, while etc.
T A R U N S H A R M A 5
Identifier
Identifier refers to the name of variable, functions and array. These are user define names &
consist of a sequence of letter & digits both uppercase and lowercase letters are permitted.
Rule of identifier:
1. First character must be an alphabet and underscore.
2. Must consist of only letters, digits and underscore.
3. Cannot use a keyword.
4. Must not contain white space.
For example:
int price;
int tv_price;
Here, price & tv_price; is a identifier which denotes a variable of type integer.
T A R U N S H A R M A 6
Separators
Separators are used to separate a program statement in a program. For example, comma “,”,
parenthesis “( )”, curly braces “{ }”, square braces “[ ]”.
T A R U N S H A R M A 7
Constants
Constant in ‘C’ refers to fixed value & do not change during the execution of a program. ‘C’
supports several types of constant.
1. Integer Constants
2. Real Constants / Floating Point Constants
3. Character Constants
4. String Constants
T A R U N S H A R M A 8
Integer Constants
Integer constants are whole numbers without any fractional part. Thus integer constants consist
of a sequence of digits. Integer constants can be written in three different number systems:
Decimal, Octal and Hexadecimal.
A decimal integer constant consists of any combination of digits taken from the set 0 through 9.
The octal constant starts from 0 like “013”. And the hexadecimal constant starts from “0x” like
“0x16”.
Example: “145”, “12223”, “-1234”.
T A R U N S H A R M A 9
Real Constants
A floating-point constant is a base-10 number that contains either a decimal point or an
exponent or both.
The floating point must have a decimal point which may be positive or negative. Use of blank
space and comma is not allowed between floating/ real constants.
Example: “+194.143”, “-416.41”.
T A R U N S H A R M A 10
Character Constants
Every number, symbol or a digit in a single quotes called character constants. Character
constants are of two types:
Single Character Constants
A character constant is a single character, enclosed in single quotation marks. e.g., ‘A’ ‘B’ ‘1’.
Characters are stored internally in computer as coded set of binary digits, which have positive
decimal integer equivalents. The value of a character constant is the numeric value of the
character in the machine’s character set.
For example, on ASCII machine the value of ‘A’ is 65.
T A R U N S H A R M A 11
Character Constants Continue..
Non Graphical Character / Escape Sequence Character Constants:
C supports some special escape sequence characters that are used to do special tasks. These are
also called as 'Backslash characters'. Some of the escape sequence characters are as follow:
T A R U N S H A R M A 12
Character Constants Continue..
String Constant
It is collection of characters enclosed in double quotes. It may contain letters, digits, special
characters and blank space. Example:
“Hello World!"
T A R U N S H A R M A 13
Operators
The symbols which are used to perform logical and mathematical operations in a C program are
called C operators. C supports a rich set of built in operators. We have already used several of
them, such as +, -, *, /, %. Operators are used to perform a program to manipulate data &
variables. Operators are classified into a number of categories:
1. Arithmetic Operators
2. Relational Operator
3. Logical Operator
4. Assignment Operator
5. Increment & Decrement Operator
6. Conditional Operator
7. Bitwise Operator
8. Special Operator (Sizeof())
T A R U N S H A R M A 14
Arithmetic Operator
C Arithmetic operators are used to perform mathematical calculations like addition, subtraction,
multiplication, division and modulus in C programs.
Example: “c=a+b;”
T A R U N S H A R M A 15
Relational Operator
Relational operators are used to find the relation between two variables i.e. to compare the
values of two variables in a C program. For example, we may compare the age of 2 persons, or
the price of 2 items and so on.
Example: “age>=60;”
T A R U N S H A R M A 16
Logical Operator
These operators are used to perform logical operations on the given expressions. There are 3
logical operators in C language. They are, logical AND (&&), logical OR (||) and logical NOT (!). It
returns Boolean values (0,1). Truth Table:
Example: “a==b && a%2==0”
T A R U N S H A R M A 17
Assignment Operator
In C programs, values for the variables are assigned using assignment operators. For example, if
the value “10″ is to be assigned for the variable “sum”, it can be assigned as “sum = 10;”. Other
assignment operators in C language are given below.
T A R U N S H A R M A 18
Bitwise Operator
These operators are used to perform bit operations. Decimal values are converted into binary
values which are the sequence of bits and bit wise operators work on these bits. Bit wise
operators in C language are & (bitwise AND), | (bitwise OR), ^ (XOR), << (left shift) and >> (right
shift).
T A R U N S H A R M A 19
Bitwise Operator Continue.
Truth Table of Bitwise Operator
T A R U N S H A R M A 20
Bitwise Operator Continue.
Bitwise AND (&) Operator
The output of Bitwise AND is 1 if both the corresponding bits of operand is 1. If either of bit is 0
or both bits are 0, the output will be 0.
T A R U N S H A R M A 21
Bitwise Operator Continue.
Bitwise OR (|) Operator:
The output of bitwise OR is 1 if either of the bit is 1 or both the bits are 1. In C Programming,
bitwise OR operator is denoted by |.
T A R U N S H A R M A 22
Bitwise Operator Continue.
Bitwise XOR (Exclusive OR) Operator
The output of bitwise XOR operator is 1 if the corresponding bits of two operators are opposite
(i.e., To get corresponding output bit 1; if corresponding bit of first operand is 0 then,
corresponding bit of second operand should be 1 and vice-versa.). It is denoted by ^.
T A R U N S H A R M A 23
Bitwise Operator Continue.
Bitwise Left Shift Operator
Left shift operator moves the all bits towards the left by certain number of bits which can be
specified. It is denoted by <<.
T A R U N S H A R M A 24
Bitwise Operator Continue.
Bitwise Right Shift Operator
Right shift operator moves the all bits towards the right by certain number of bits which can be
specified. It is denoted by >>.
T A R U N S H A R M A 25
Conditional / Ternary Operator
Conditional operators return one value if condition is true and returns another value is condition
is false. This operator is also called as ternary operator.
Syntax : (Condition? true_value: false_value);
Example: (A > 100? 0: 1);
In above example, if A is greater than 100, 0 is returned else 1 is returned.
T A R U N S H A R M A 26
Increment / Decrement Operator
Increment operators are used to increase the value of the variable by one and decrement
operators are used to decrease the value of the variable by one in C programs.
Syntax:
Increment operator : ++var_name; (or) var_name++;
Decrement operator : -- var_name; (or) var_name --;
Example:
Increment operator: ++ i; i ++;
Decrement operator: --i; i--;
T A R U N S H A R M A 27
Increment / Decrement Operator Cont.
Difference between ++ and -- operator as postfix and prefix:
When ++ is used as prefix (like: ++var), ++var will increment the value of var and then return it
but, if ++ is used as postfix (like: var++), operator will return the value of operand first and then
only increment it.
Example:
a=10;
b=a++; a=11 b=10
B=++a; a=11 b=11
T A R U N S H A R M A 28
Special Operators
Some of special operators that C language offers.
T A R U N S H A R M A 29
Thank You
TARUN SHARMA
30

Más contenido relacionado

La actualidad más candente

La actualidad más candente (20)

Constants in C Programming
Constants in C ProgrammingConstants in C Programming
Constants in C Programming
 
Pointers C programming
Pointers  C programmingPointers  C programming
Pointers C programming
 
Arrays and Strings
Arrays and Strings Arrays and Strings
Arrays and Strings
 
Introduction to c++ ppt 1
Introduction to c++ ppt 1Introduction to c++ ppt 1
Introduction to c++ ppt 1
 
FUNCTIONS IN c++ PPT
FUNCTIONS IN c++ PPTFUNCTIONS IN c++ PPT
FUNCTIONS IN c++ PPT
 
C# lecture 2: Literals , Variables and Data Types in C#
C# lecture 2: Literals , Variables and Data Types in C#C# lecture 2: Literals , Variables and Data Types in C#
C# lecture 2: Literals , Variables and Data Types in C#
 
Array and string
Array and stringArray and string
Array and string
 
Static Data Members and Member Functions
Static Data Members and Member FunctionsStatic Data Members and Member Functions
Static Data Members and Member Functions
 
Strings in C language
Strings in C languageStrings in C language
Strings in C language
 
Function in C
Function in CFunction in C
Function in C
 
C programming - String
C programming - StringC programming - String
C programming - String
 
String functions in C
String functions in CString functions in C
String functions in C
 
Unit 3. Input and Output
Unit 3. Input and OutputUnit 3. Input and Output
Unit 3. Input and Output
 
Programming in c Arrays
Programming in c ArraysProgramming in c Arrays
Programming in c Arrays
 
Function in C program
Function in C programFunction in C program
Function in C program
 
Formatted input and output
Formatted input and outputFormatted input and output
Formatted input and output
 
constants, variables and datatypes in C
constants, variables and datatypes in Cconstants, variables and datatypes in C
constants, variables and datatypes in C
 
MANAGING INPUT AND OUTPUT OPERATIONS IN C MRS.SOWMYA JYOTHI.pdf
MANAGING INPUT AND OUTPUT OPERATIONS IN C    MRS.SOWMYA JYOTHI.pdfMANAGING INPUT AND OUTPUT OPERATIONS IN C    MRS.SOWMYA JYOTHI.pdf
MANAGING INPUT AND OUTPUT OPERATIONS IN C MRS.SOWMYA JYOTHI.pdf
 
C++ presentation
C++ presentationC++ presentation
C++ presentation
 
[OOP - Lec 19] Static Member Functions
[OOP - Lec 19] Static Member Functions[OOP - Lec 19] Static Member Functions
[OOP - Lec 19] Static Member Functions
 

Similar a C Token’s

Fundamentals of C Programming Language
Fundamentals of C Programming LanguageFundamentals of C Programming Language
Fundamentals of C Programming LanguageRamaBoya2
 
C programming | Class 8 | III Term
C programming  | Class 8  | III TermC programming  | Class 8  | III Term
C programming | Class 8 | III TermAndrew Raj
 
C programming(Part 1)
C programming(Part 1)C programming(Part 1)
C programming(Part 1)SURBHI SAROHA
 
Getting started with c++
Getting started with c++Getting started with c++
Getting started with c++K Durga Prasad
 
Object Oriented Programming with C++
Object Oriented Programming with C++Object Oriented Programming with C++
Object Oriented Programming with C++Rokonuzzaman Rony
 
Introduction to C Programming - R.D.Sivakumar
Introduction to C Programming -  R.D.SivakumarIntroduction to C Programming -  R.D.Sivakumar
Introduction to C Programming - R.D.SivakumarSivakumar R D .
 
Data Types and Variables In C Programming
Data Types and Variables In C ProgrammingData Types and Variables In C Programming
Data Types and Variables In C ProgrammingKamal Acharya
 
data type.pptxddddswwyertr hai na ki extend kr de la
data type.pptxddddswwyertr hai na ki extend kr de ladata type.pptxddddswwyertr hai na ki extend kr de la
data type.pptxddddswwyertr hai na ki extend kr de laLEOFAKE
 
02a fundamental c++ types, arithmetic
02a   fundamental c++ types, arithmetic 02a   fundamental c++ types, arithmetic
02a fundamental c++ types, arithmetic Manzoor ALam
 

Similar a C Token’s (20)

Fundamentals of C Programming Language
Fundamentals of C Programming LanguageFundamentals of C Programming Language
Fundamentals of C Programming Language
 
C programming | Class 8 | III Term
C programming  | Class 8  | III TermC programming  | Class 8  | III Term
C programming | Class 8 | III Term
 
C programming(Part 1)
C programming(Part 1)C programming(Part 1)
C programming(Part 1)
 
Getting Started with C++
Getting Started with C++Getting Started with C++
Getting Started with C++
 
1 Revision Tour
1 Revision Tour1 Revision Tour
1 Revision Tour
 
Getting started with C++
Getting started with C++Getting started with C++
Getting started with C++
 
Getting started with c++
Getting started with c++Getting started with c++
Getting started with c++
 
Getting started with c++
Getting started with c++Getting started with c++
Getting started with c++
 
C language basics
C language basicsC language basics
C language basics
 
Object Oriented Programming with C++
Object Oriented Programming with C++Object Oriented Programming with C++
Object Oriented Programming with C++
 
Introduction to C Programming - R.D.Sivakumar
Introduction to C Programming -  R.D.SivakumarIntroduction to C Programming -  R.D.Sivakumar
Introduction to C Programming - R.D.Sivakumar
 
Data Types and Variables In C Programming
Data Types and Variables In C ProgrammingData Types and Variables In C Programming
Data Types and Variables In C Programming
 
C program
C programC program
C program
 
data type.pptxddddswwyertr hai na ki extend kr de la
data type.pptxddddswwyertr hai na ki extend kr de ladata type.pptxddddswwyertr hai na ki extend kr de la
data type.pptxddddswwyertr hai na ki extend kr de la
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
 
PSPC--UNIT-2.pdf
PSPC--UNIT-2.pdfPSPC--UNIT-2.pdf
PSPC--UNIT-2.pdf
 
Ch02
Ch02Ch02
Ch02
 
02a fundamental c++ types, arithmetic
02a   fundamental c++ types, arithmetic 02a   fundamental c++ types, arithmetic
02a fundamental c++ types, arithmetic
 
Introduction
IntroductionIntroduction
Introduction
 
CHAPTER 2
CHAPTER 2CHAPTER 2
CHAPTER 2
 

Más de Tarun Sharma

Control Flow Statements
Control Flow Statements Control Flow Statements
Control Flow Statements Tarun Sharma
 
C Question Paper Solution - MDSU Ajmer
C Question Paper Solution - MDSU AjmerC Question Paper Solution - MDSU Ajmer
C Question Paper Solution - MDSU AjmerTarun Sharma
 
Introduction of c programming
Introduction of c programmingIntroduction of c programming
Introduction of c programmingTarun Sharma
 
Introduction to C Language
Introduction to C LanguageIntroduction to C Language
Introduction to C LanguageTarun Sharma
 
Remote Desktop Access
Remote Desktop AccessRemote Desktop Access
Remote Desktop AccessTarun Sharma
 
Generations of Programming Languages
Generations of Programming LanguagesGenerations of Programming Languages
Generations of Programming LanguagesTarun Sharma
 

Más de Tarun Sharma (8)

Control Flow Statements
Control Flow Statements Control Flow Statements
Control Flow Statements
 
C Question Paper Solution - MDSU Ajmer
C Question Paper Solution - MDSU AjmerC Question Paper Solution - MDSU Ajmer
C Question Paper Solution - MDSU Ajmer
 
Armstrong numbers
Armstrong numbersArmstrong numbers
Armstrong numbers
 
Introduction of c programming
Introduction of c programmingIntroduction of c programming
Introduction of c programming
 
Data types in C
Data types in CData types in C
Data types in C
 
Introduction to C Language
Introduction to C LanguageIntroduction to C Language
Introduction to C Language
 
Remote Desktop Access
Remote Desktop AccessRemote Desktop Access
Remote Desktop Access
 
Generations of Programming Languages
Generations of Programming LanguagesGenerations of Programming Languages
Generations of Programming Languages
 

Último

Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...JojoEDelaCruz
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYKayeClaireEstoconing
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxVanesaIglesias10
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxlancelewisportillo
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)cama23
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfVanessa Camilleri
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 

Último (20)

Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptx
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdf
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 

C Token’s

  • 2. Character Sets A character refers to the digit, alphabet or special symbol used to data representation. 1. Alphabets : A-Z, a-z 2. Digits : 0-9 3. Special Characters: ~! @ # $ % ^ & * ( ) _ + { } [ ] - <> , . / ? | : ; " ' 4. White Spaces : Horizontal tab, Carriage return, New line, form feed T A R U N S H A R M A 2
  • 3. Token’s C tokens are the basic buildings blocks in C language which are constructed together to write a C program. Each and every smallest individual unit in a C program is known as C tokens. C has five types of tokens: 1. Keywords 2. Identifiers 3. Constants 4. Separators 5. Operators T A R U N S H A R M A 3
  • 4. For Example:  main – identifier  {,}, (,) – separator  int – keyword  x, y, total – identifier  main, {, }, (, ), int, x, y, total – tokens T A R U N S H A R M A 4
  • 5. Keywords All keywords have fixed meaning & there meanings cannot be changed during the execution of a program. Keywords served as basic building block for program statements. White spaces are not allowed in keywords. Keywords may not be used as an identifier. ‘C’ has 32 keywords, all keywords written in lower case. For example, if, int, for, float, while etc. T A R U N S H A R M A 5
  • 6. Identifier Identifier refers to the name of variable, functions and array. These are user define names & consist of a sequence of letter & digits both uppercase and lowercase letters are permitted. Rule of identifier: 1. First character must be an alphabet and underscore. 2. Must consist of only letters, digits and underscore. 3. Cannot use a keyword. 4. Must not contain white space. For example: int price; int tv_price; Here, price & tv_price; is a identifier which denotes a variable of type integer. T A R U N S H A R M A 6
  • 7. Separators Separators are used to separate a program statement in a program. For example, comma “,”, parenthesis “( )”, curly braces “{ }”, square braces “[ ]”. T A R U N S H A R M A 7
  • 8. Constants Constant in ‘C’ refers to fixed value & do not change during the execution of a program. ‘C’ supports several types of constant. 1. Integer Constants 2. Real Constants / Floating Point Constants 3. Character Constants 4. String Constants T A R U N S H A R M A 8
  • 9. Integer Constants Integer constants are whole numbers without any fractional part. Thus integer constants consist of a sequence of digits. Integer constants can be written in three different number systems: Decimal, Octal and Hexadecimal. A decimal integer constant consists of any combination of digits taken from the set 0 through 9. The octal constant starts from 0 like “013”. And the hexadecimal constant starts from “0x” like “0x16”. Example: “145”, “12223”, “-1234”. T A R U N S H A R M A 9
  • 10. Real Constants A floating-point constant is a base-10 number that contains either a decimal point or an exponent or both. The floating point must have a decimal point which may be positive or negative. Use of blank space and comma is not allowed between floating/ real constants. Example: “+194.143”, “-416.41”. T A R U N S H A R M A 10
  • 11. Character Constants Every number, symbol or a digit in a single quotes called character constants. Character constants are of two types: Single Character Constants A character constant is a single character, enclosed in single quotation marks. e.g., ‘A’ ‘B’ ‘1’. Characters are stored internally in computer as coded set of binary digits, which have positive decimal integer equivalents. The value of a character constant is the numeric value of the character in the machine’s character set. For example, on ASCII machine the value of ‘A’ is 65. T A R U N S H A R M A 11
  • 12. Character Constants Continue.. Non Graphical Character / Escape Sequence Character Constants: C supports some special escape sequence characters that are used to do special tasks. These are also called as 'Backslash characters'. Some of the escape sequence characters are as follow: T A R U N S H A R M A 12
  • 13. Character Constants Continue.. String Constant It is collection of characters enclosed in double quotes. It may contain letters, digits, special characters and blank space. Example: “Hello World!" T A R U N S H A R M A 13
  • 14. Operators The symbols which are used to perform logical and mathematical operations in a C program are called C operators. C supports a rich set of built in operators. We have already used several of them, such as +, -, *, /, %. Operators are used to perform a program to manipulate data & variables. Operators are classified into a number of categories: 1. Arithmetic Operators 2. Relational Operator 3. Logical Operator 4. Assignment Operator 5. Increment & Decrement Operator 6. Conditional Operator 7. Bitwise Operator 8. Special Operator (Sizeof()) T A R U N S H A R M A 14
  • 15. Arithmetic Operator C Arithmetic operators are used to perform mathematical calculations like addition, subtraction, multiplication, division and modulus in C programs. Example: “c=a+b;” T A R U N S H A R M A 15
  • 16. Relational Operator Relational operators are used to find the relation between two variables i.e. to compare the values of two variables in a C program. For example, we may compare the age of 2 persons, or the price of 2 items and so on. Example: “age>=60;” T A R U N S H A R M A 16
  • 17. Logical Operator These operators are used to perform logical operations on the given expressions. There are 3 logical operators in C language. They are, logical AND (&&), logical OR (||) and logical NOT (!). It returns Boolean values (0,1). Truth Table: Example: “a==b && a%2==0” T A R U N S H A R M A 17
  • 18. Assignment Operator In C programs, values for the variables are assigned using assignment operators. For example, if the value “10″ is to be assigned for the variable “sum”, it can be assigned as “sum = 10;”. Other assignment operators in C language are given below. T A R U N S H A R M A 18
  • 19. Bitwise Operator These operators are used to perform bit operations. Decimal values are converted into binary values which are the sequence of bits and bit wise operators work on these bits. Bit wise operators in C language are & (bitwise AND), | (bitwise OR), ^ (XOR), << (left shift) and >> (right shift). T A R U N S H A R M A 19
  • 20. Bitwise Operator Continue. Truth Table of Bitwise Operator T A R U N S H A R M A 20
  • 21. Bitwise Operator Continue. Bitwise AND (&) Operator The output of Bitwise AND is 1 if both the corresponding bits of operand is 1. If either of bit is 0 or both bits are 0, the output will be 0. T A R U N S H A R M A 21
  • 22. Bitwise Operator Continue. Bitwise OR (|) Operator: The output of bitwise OR is 1 if either of the bit is 1 or both the bits are 1. In C Programming, bitwise OR operator is denoted by |. T A R U N S H A R M A 22
  • 23. Bitwise Operator Continue. Bitwise XOR (Exclusive OR) Operator The output of bitwise XOR operator is 1 if the corresponding bits of two operators are opposite (i.e., To get corresponding output bit 1; if corresponding bit of first operand is 0 then, corresponding bit of second operand should be 1 and vice-versa.). It is denoted by ^. T A R U N S H A R M A 23
  • 24. Bitwise Operator Continue. Bitwise Left Shift Operator Left shift operator moves the all bits towards the left by certain number of bits which can be specified. It is denoted by <<. T A R U N S H A R M A 24
  • 25. Bitwise Operator Continue. Bitwise Right Shift Operator Right shift operator moves the all bits towards the right by certain number of bits which can be specified. It is denoted by >>. T A R U N S H A R M A 25
  • 26. Conditional / Ternary Operator Conditional operators return one value if condition is true and returns another value is condition is false. This operator is also called as ternary operator. Syntax : (Condition? true_value: false_value); Example: (A > 100? 0: 1); In above example, if A is greater than 100, 0 is returned else 1 is returned. T A R U N S H A R M A 26
  • 27. Increment / Decrement Operator Increment operators are used to increase the value of the variable by one and decrement operators are used to decrease the value of the variable by one in C programs. Syntax: Increment operator : ++var_name; (or) var_name++; Decrement operator : -- var_name; (or) var_name --; Example: Increment operator: ++ i; i ++; Decrement operator: --i; i--; T A R U N S H A R M A 27
  • 28. Increment / Decrement Operator Cont. Difference between ++ and -- operator as postfix and prefix: When ++ is used as prefix (like: ++var), ++var will increment the value of var and then return it but, if ++ is used as postfix (like: var++), operator will return the value of operand first and then only increment it. Example: a=10; b=a++; a=11 b=10 B=++a; a=11 b=11 T A R U N S H A R M A 28
  • 29. Special Operators Some of special operators that C language offers. T A R U N S H A R M A 29