SlideShare a Scribd company logo
1 of 10
INTRODUCING THE
      ‘C’
C Tokens
• A token is an atomic unit (smallest indivisible
  units) in a program.
• The most basic elements in a C program
  recognized by the compiler are a single character
  or a group of characters called C tokens.
• The compiler cannot breakdown the token any
  further.
   For example, the words main, ‘,‘ (brace), ‘(‘
  (parenthesis) are all tokens of C program.
Types of Tokens
1. Keywords
     Examples: float, int, double, while, for.
2. Identifiers
     Examples: amount
3. Constants
     Examples: 12.4, 7894
4. Strings
     Examples: “CSM”, “Thursday”
5. Special Symbols
     Examples: [,], {, }, (, )
6. Operators
     Examples: +, *, /
C Character Set
• The C character set includes the upper case
  letters A to Z, the lower case a to z, the decimal
  digits 0 to 9 and certain special characters.

• Letters a, b, c, ……………z

• Digits    0, 1, 2, 3, 4, 5, 6, 7, 8, 9

• Special characters       ~,.;:?‘“!()*+,-/<>
  =+-$#@&*%^
Identifiers
• Identifiers are distinct names given to program
  elements such as constants, variables, etc.
• An Identifier is a sequence of letters, digits, and the
  special character ‘_’ (underscore).
1. It must start with either a letter or underscore. ‘_’
2. No commas or blanks are allowed within a variable
    name.
3. The upper case and lower case letters are treated as
    distinct, i.e., identifiers are case-sensitive.
4. An identifier can be of any length.
5. No special symbol can be used in a variable name.
Keywords
• Keywords are predefined tokens in C. These
  are also called reserved words.
• Key words have special meaning to the C
  compiler. These key words can be used only
  for their intended action; they cannot be
  used for any other purpose.
• C has 32 keywords.
32 Keywords
•   auto     break    case     char     const
•   continue default   do      double    else
•   enum     extern    float   for         goto
•   if        int    long      register  return
•   Short signed sizeof        static      struct
•   switch   typedef union     unsigned void
•   volatile while
Data Types
• A data type defines a set of values and the
  operations that can be performed on them.
• Every data type item (constant, variable etc.)
  in a C program has a data type associated with
  it.
• C also has a special data type called void,
  which, indicates that any data type, does not
  describe the data items.
Lec9

More Related Content

What's hot

C# Value Data Types and Reference Data Types
C# Value Data Types and Reference Data TypesC# Value Data Types and Reference Data Types
C# Value Data Types and Reference Data TypesMicheal Ogundero
 
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
 
What is identifier c programming
What is identifier c programmingWhat is identifier c programming
What is identifier c programmingRumman Ansari
 
3 data-types-in-c
3 data-types-in-c3 data-types-in-c
3 data-types-in-cteach4uin
 
constants, variables and datatypes in C
constants, variables and datatypes in Cconstants, variables and datatypes in C
constants, variables and datatypes in CSahithi Naraparaju
 
Concept of c data types
Concept of c data typesConcept of c data types
Concept of c data typesManisha Keim
 
Data Type in C Programming
Data Type in C ProgrammingData Type in C Programming
Data Type in C ProgrammingQazi Shahzad Ali
 
Constant, variables, data types
Constant, variables, data typesConstant, variables, data types
Constant, variables, data typesPratik Devmurari
 
Chapter1 c programming data types, variables and constants
Chapter1 c programming   data types, variables and constantsChapter1 c programming   data types, variables and constants
Chapter1 c programming data types, variables and constantsvinay arora
 
Datatype in c++ unit 3 -topic 2
Datatype in c++ unit 3 -topic 2Datatype in c++ unit 3 -topic 2
Datatype in c++ unit 3 -topic 2MOHIT TOMAR
 
Programming construction tools
Programming construction toolsProgramming construction tools
Programming construction toolssunilchute1
 
Data types and Operators
Data types and OperatorsData types and Operators
Data types and Operatorsraksharao
 
INTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMINGINTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMINGAbhishek Dwivedi
 

What's hot (20)

C# Value Data Types and Reference Data Types
C# Value Data Types and Reference Data TypesC# Value Data Types and Reference Data Types
C# Value Data Types and Reference Data Types
 
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
 
What is identifier c programming
What is identifier c programmingWhat is identifier c programming
What is identifier c programming
 
C Slides
C SlidesC Slides
C Slides
 
3 data-types-in-c
3 data-types-in-c3 data-types-in-c
3 data-types-in-c
 
Lecture02(constants, variable & data types)
Lecture02(constants, variable & data types)Lecture02(constants, variable & data types)
Lecture02(constants, variable & data types)
 
constants, variables and datatypes in C
constants, variables and datatypes in Cconstants, variables and datatypes in C
constants, variables and datatypes in C
 
Concept of c data types
Concept of c data typesConcept of c data types
Concept of c data types
 
Data type
Data typeData type
Data type
 
Data Type in C Programming
Data Type in C ProgrammingData Type in C Programming
Data Type in C Programming
 
Constant, variables, data types
Constant, variables, data typesConstant, variables, data types
Constant, variables, data types
 
Lect 9(pointers) Zaheer Abbas
Lect 9(pointers) Zaheer AbbasLect 9(pointers) Zaheer Abbas
Lect 9(pointers) Zaheer Abbas
 
Chapter1 c programming data types, variables and constants
Chapter1 c programming   data types, variables and constantsChapter1 c programming   data types, variables and constants
Chapter1 c programming data types, variables and constants
 
Datatype in c++ unit 3 -topic 2
Datatype in c++ unit 3 -topic 2Datatype in c++ unit 3 -topic 2
Datatype in c++ unit 3 -topic 2
 
Programming construction tools
Programming construction toolsProgramming construction tools
Programming construction tools
 
7.data types in c#
7.data types in c#7.data types in c#
7.data types in c#
 
C introduction
C introductionC introduction
C introduction
 
Data types and Operators
Data types and OperatorsData types and Operators
Data types and Operators
 
Data types
Data typesData types
Data types
 
INTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMINGINTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMING
 

Similar to Lec9 (20)

C Programming Lecture 3 - Elements of C.pptx
C Programming Lecture 3 - Elements of C.pptxC Programming Lecture 3 - Elements of C.pptx
C Programming Lecture 3 - Elements of C.pptx
 
Cp presentation
Cp presentationCp presentation
Cp presentation
 
C PROGRAMMING LANGUAGE.pptx
 C PROGRAMMING LANGUAGE.pptx C PROGRAMMING LANGUAGE.pptx
C PROGRAMMING LANGUAGE.pptx
 
Chap 1 and 2
Chap 1 and 2Chap 1 and 2
Chap 1 and 2
 
CONSTANTS, VARIABLES & DATATYPES IN C
CONSTANTS, VARIABLES & DATATYPES IN CCONSTANTS, VARIABLES & DATATYPES IN C
CONSTANTS, VARIABLES & DATATYPES IN C
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
 
Introduction to C
Introduction to CIntroduction to C
Introduction to C
 
Chapter 2: Elementary Programming
Chapter 2: Elementary ProgrammingChapter 2: Elementary Programming
Chapter 2: Elementary Programming
 
C PROGRAMING.pptx
C PROGRAMING.pptxC PROGRAMING.pptx
C PROGRAMING.pptx
 
C language
C languageC language
C language
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
 
Funa-C.ppt
Funa-C.pptFuna-C.ppt
Funa-C.ppt
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
 
Basics of C (1).ppt
Basics of C (1).pptBasics of C (1).ppt
Basics of C (1).ppt
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
 
C programming basic pdf.ppt
C programming basic pdf.pptC programming basic pdf.ppt
C programming basic pdf.ppt
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
 

More from kapil078

12 lec 12 loop
12 lec 12 loop 12 lec 12 loop
12 lec 12 loop kapil078
 
11 lec 11 storage class
11 lec 11 storage class11 lec 11 storage class
11 lec 11 storage classkapil078
 
Btech 1st yr midterm 1st
Btech 1st yr midterm 1stBtech 1st yr midterm 1st
Btech 1st yr midterm 1stkapil078
 
Cmp104 lec 7 algorithm and flowcharts
Cmp104 lec 7 algorithm and flowchartsCmp104 lec 7 algorithm and flowcharts
Cmp104 lec 7 algorithm and flowchartskapil078
 
Cmp104 lec 6 computer lang
Cmp104 lec 6 computer langCmp104 lec 6 computer lang
Cmp104 lec 6 computer langkapil078
 
Cmp104 lec 2 number system
Cmp104 lec 2 number systemCmp104 lec 2 number system
Cmp104 lec 2 number systemkapil078
 
Cmp104 lec 6 computer lang
Cmp104 lec 6 computer langCmp104 lec 6 computer lang
Cmp104 lec 6 computer langkapil078
 
Cmp104 lec 4 types of computer
Cmp104 lec 4 types of computerCmp104 lec 4 types of computer
Cmp104 lec 4 types of computerkapil078
 
Cmp104 lec 3 component of computer
Cmp104 lec 3 component of computerCmp104 lec 3 component of computer
Cmp104 lec 3 component of computerkapil078
 
Cmp104 lec 1
Cmp104 lec 1Cmp104 lec 1
Cmp104 lec 1kapil078
 
cmp104 lec 8
cmp104 lec 8cmp104 lec 8
cmp104 lec 8kapil078
 

More from kapil078 (13)

12 lec 12 loop
12 lec 12 loop 12 lec 12 loop
12 lec 12 loop
 
11 lec 11 storage class
11 lec 11 storage class11 lec 11 storage class
11 lec 11 storage class
 
Lec 10
Lec 10Lec 10
Lec 10
 
Btech 1st yr midterm 1st
Btech 1st yr midterm 1stBtech 1st yr midterm 1st
Btech 1st yr midterm 1st
 
Cmp 104
Cmp 104Cmp 104
Cmp 104
 
Cmp104 lec 7 algorithm and flowcharts
Cmp104 lec 7 algorithm and flowchartsCmp104 lec 7 algorithm and flowcharts
Cmp104 lec 7 algorithm and flowcharts
 
Cmp104 lec 6 computer lang
Cmp104 lec 6 computer langCmp104 lec 6 computer lang
Cmp104 lec 6 computer lang
 
Cmp104 lec 2 number system
Cmp104 lec 2 number systemCmp104 lec 2 number system
Cmp104 lec 2 number system
 
Cmp104 lec 6 computer lang
Cmp104 lec 6 computer langCmp104 lec 6 computer lang
Cmp104 lec 6 computer lang
 
Cmp104 lec 4 types of computer
Cmp104 lec 4 types of computerCmp104 lec 4 types of computer
Cmp104 lec 4 types of computer
 
Cmp104 lec 3 component of computer
Cmp104 lec 3 component of computerCmp104 lec 3 component of computer
Cmp104 lec 3 component of computer
 
Cmp104 lec 1
Cmp104 lec 1Cmp104 lec 1
Cmp104 lec 1
 
cmp104 lec 8
cmp104 lec 8cmp104 lec 8
cmp104 lec 8
 

Lec9

  • 1. INTRODUCING THE ‘C’
  • 2. C Tokens • A token is an atomic unit (smallest indivisible units) in a program. • The most basic elements in a C program recognized by the compiler are a single character or a group of characters called C tokens. • The compiler cannot breakdown the token any further. For example, the words main, ‘,‘ (brace), ‘(‘ (parenthesis) are all tokens of C program.
  • 3. Types of Tokens 1. Keywords Examples: float, int, double, while, for. 2. Identifiers Examples: amount 3. Constants Examples: 12.4, 7894 4. Strings Examples: “CSM”, “Thursday” 5. Special Symbols Examples: [,], {, }, (, ) 6. Operators Examples: +, *, /
  • 4. C Character Set • The C character set includes the upper case letters A to Z, the lower case a to z, the decimal digits 0 to 9 and certain special characters. • Letters a, b, c, ……………z • Digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 • Special characters ~,.;:?‘“!()*+,-/<> =+-$#@&*%^
  • 5.
  • 6. Identifiers • Identifiers are distinct names given to program elements such as constants, variables, etc. • An Identifier is a sequence of letters, digits, and the special character ‘_’ (underscore). 1. It must start with either a letter or underscore. ‘_’ 2. No commas or blanks are allowed within a variable name. 3. The upper case and lower case letters are treated as distinct, i.e., identifiers are case-sensitive. 4. An identifier can be of any length. 5. No special symbol can be used in a variable name.
  • 7. Keywords • Keywords are predefined tokens in C. These are also called reserved words. • Key words have special meaning to the C compiler. These key words can be used only for their intended action; they cannot be used for any other purpose. • C has 32 keywords.
  • 8. 32 Keywords • auto break case char const • continue default do double else • enum extern float for goto • if int long register return • Short signed sizeof static struct • switch typedef union unsigned void • volatile while
  • 9. Data Types • A data type defines a set of values and the operations that can be performed on them. • Every data type item (constant, variable etc.) in a C program has a data type associated with it. • C also has a special data type called void, which, indicates that any data type, does not describe the data items.