SlideShare a Scribd company logo
1 of 14
Basics of ‘C’
By Gaikwad Varsha P.
Asst. Prof. Information Technology Dept.
Govt. College of Engg. Aurangabad
General Aspect of ‘C’
C was originally developed in the 1970s, by Dennis Ritchie
at Bell Telephone Laboratories, Inc.
C is a High level , general –purpose structured
programming language. Instructions of C consists of terms
that are very closely same to algebraic expressions,
consisting of certain English keywords such as if, else,
for ,do and while
C contains certain additional features that allows it to be
used at a lower level , acting as bridge between machine
language and the high level languages.
This allows C to be used for system programming as well
as for applications programming
The Character set of ‘C’
C language consist of some characters set, numbers and
some special symbols. The character set of C consist of all
the alphabets of English language. C consist of
Alphabets a to z, A to Z
Numeric 0,1 to 9
Special Symbols {,},[,],?,+,-,*,/,%,!,;,and more
The words formed from the character set are building
blocks of C and are sometimes known as tokens. These
tokens represent the individual entity of language. The
following different types of token are used in C
1) Identifiers 2)Keywords 3)Constants
4) Operators 5)Punctuation Symbols
Identifiers
• A 'C' program consist of two types of elements , user
defined and system defined. Idetifiers is nothing but a
name given to these eleme
• nts.
• An identifier is a word used by a programmer to name a
variable , function, or label.
• identifiers consist of letters and digits, in any order,
except that the first charecter or lable.
• Identifiers consist of letters and digits if any order,except
that the first charecter must be letter.
• Both Upper and lowercase letters can be used
Keywords
• Keywords are nothing but
system defined identifiers.
• Keywords are reserved
words of the language.
• They have specific meaning
in the language and cannot
be used by the programmer
as variable or constant
names
• C is case senitive, it means
these must be used as it is
• 32 Keywords in C
Programming
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
Variables
• A variable is nothing but a name given to a storage area that our programs
can manipulate. Each variable in C has a specific type, which determines
the size and layout of the variable's memory; the range of values that can be
stored within that memory; and the set of operations that can be applied to
the variable.
• The name of a variable can be composed of letters, digits, and the
underscore character. It must begin with either a letter or an underscore.
Upper and lowercase letters are distinct because C is case-sensitive. There
are following basic variable types −
Type Description
• char Typically a single octet(one byte). This is an integer type.
• int The most natural size of integer for the machine.
• float A single-precision floating point value.
• double A double-precision floating point value.
• void Represents the absence of type.
Constants
• A constant is a value or an identifier whose value cannot be
altered in a program. For example: 1, 2.5,
• As mentioned, an identifier also can be defined as a constant.
eg. const double PI = 3.14
• Here, PI is a constant. Basically what it means is that, PI and
3.14 is same for this program.
Integer constants
• A integer constant is a numeric constant (associated with
number) without any fractional or exponential part. There are
three types of integer constants in C programming:
• decimal constant(base 10)
• octal constant(base 8)
• hexadecimal constant(base 16)
Constants
Floating-point constants
• A floating point constant is a numeric constant that has
either a fractional form or an exponent form. For
example: 2.0,0.0000234,-0.22E-5
Character constants
• A character constant is a constant which uses single
quotation around characters. For example: 'a', 'l', 'm', 'F'
String constants
• String constants are the constants which are enclosed in
a pair of double-quote marks. For example:
"good" ,"x","Earth is roundn"
Escape Sequences
Sometimes, it is necessary to use characters which cannot be typed or has
special meaning in C programming. For example: newline(enter), tab,
question mark etc. In order to use these characters, escape sequence is
used.
• For example: n is used for newline. The backslash (  ) causes "escape"
from the normal way the characters are interpreted by the compiler.Escape
Sequences Character
• b Backspace
• f Form feed
• n Newline
• r Return
• t Horizontal tab
• v Vertical tab
•  Backslash
• ' Single quotation mark
• " Double quotation mark
• ? Question mark
• 0 Null character
Operators in C:An operator is a symbol which operates on a
value or a variable. For example: + is an operator to perform addition.
C programming has wide range of operators to perform
various operations. For better understanding of
operators, these operators can be classified as:
• Arithmetic Operators
• Increment and Decrement Operators
• Assignment Operators
• Relational Operators
• Logical Operators
• Conditional Operators
• Bitwise Operators
• Special Operators
Arithmetic Operator
• Operator Meaning of Operator
• + addition or unary plus
• - subtraction or unary minus
• * multiplication
• / division
• % remainder after
division( modulo division)
Increment and Decrement Operators
1. C programming has two operators increment
++ and decrement -- to change the value of an
operand (constant or variable) by 1.
2. Increment ++ increases the value by 1
whereas decrement -- decreases the value by 1.
3. These two operators are unary operators,
meaning they only operate on a single operand.
eg. int a=10, b=100
++a = 11
--b = 99
C Assignment Operators
• An assignment operator is used for assigning a
value to a variable. The most common
assignment operator is =
• Operator Example Same as
• = a = b a = b
• += a += b a = a+b
• -= a -= b a = a-b
• *= a *= b a = a*b
• /= a /= b a = a/b
• %= a %= b a = a%b
C Relational Operators
• A relational operator checks the relationship between
two operands. If the relation is true, it returns 1; if the
relation is false, it returns value 0.
• Relational operators are used in decision making and
loops.
Operator Meaning of Operator Example
• == Equal to 5 == 3 returns 0
• > Greater than 5 > 3 returns 1
• < Less than 5 < 3 returns 0
• != Not equal to 5 != 3 returns 1
• >= Greater than or equal to 5 >= 3 returns 1
• <= Less than or equal to 5 <= 3 return 0

More Related Content

What's hot

Introduction of c_language
Introduction of c_languageIntroduction of c_language
Introduction of c_languageSINGH PROJECTS
 
Introduction of c programming unit-ii ppt
Introduction of  c programming unit-ii pptIntroduction of  c programming unit-ii ppt
Introduction of c programming unit-ii pptJStalinAsstProfessor
 
C presentation book
C presentation bookC presentation book
C presentation bookkrunal1210
 
What is identifier c programming
What is identifier c programmingWhat is identifier c programming
What is identifier c programmingRumman Ansari
 
Fundamentals of c language
Fundamentals of c languageFundamentals of c language
Fundamentals of c languageAkshhayPatel
 
Basic C Programming language
Basic C Programming languageBasic C Programming language
Basic C Programming languageAbhishek Soni
 
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
 
Programming in C- Introduction
Programming in C- IntroductionProgramming in C- Introduction
Programming in C- Introductionsavitamhaske
 
Structure of c_program_to_input_output
Structure of c_program_to_input_outputStructure of c_program_to_input_output
Structure of c_program_to_input_outputAnil Dutt
 
Basic of c language
Basic of c languageBasic of c language
Basic of c languagesunilchute1
 
Complete Tokens in c/c++
Complete Tokens in c/c++Complete Tokens in c/c++
Complete Tokens in c/c++Shobi P P
 
Constants and variables in c programming
Constants and variables in c programmingConstants and variables in c programming
Constants and variables in c programmingChitrank Dixit
 
Lecture 2 variables
Lecture 2 variablesLecture 2 variables
Lecture 2 variablesTony Apreku
 
Variables and data types in C++
Variables and data types in C++Variables and data types in C++
Variables and data types in C++Ameer Khan
 
Presentation of c2
Presentation of c2Presentation of c2
Presentation of c2Love preet
 

What's hot (20)

Introduction of c_language
Introduction of c_languageIntroduction of c_language
Introduction of c_language
 
Introduction of c programming unit-ii ppt
Introduction of  c programming unit-ii pptIntroduction of  c programming unit-ii ppt
Introduction of c programming unit-ii ppt
 
CProgrammingTutorial
CProgrammingTutorialCProgrammingTutorial
CProgrammingTutorial
 
C presentation book
C presentation bookC presentation book
C presentation book
 
What is identifier c programming
What is identifier c programmingWhat is identifier c programming
What is identifier c programming
 
Fundamentals of c language
Fundamentals of c languageFundamentals of c language
Fundamentals of c language
 
Basic C Programming language
Basic C Programming languageBasic C Programming language
Basic C Programming language
 
Constant, variables, data types
Constant, variables, data typesConstant, variables, data types
Constant, variables, data types
 
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
 
Programming in C- Introduction
Programming in C- IntroductionProgramming in C- Introduction
Programming in C- Introduction
 
Structure of c_program_to_input_output
Structure of c_program_to_input_outputStructure of c_program_to_input_output
Structure of c_program_to_input_output
 
Basic of c language
Basic of c languageBasic of c language
Basic of c language
 
Complete Tokens in c/c++
Complete Tokens in c/c++Complete Tokens in c/c++
Complete Tokens in c/c++
 
Constants and variables in c programming
Constants and variables in c programmingConstants and variables in c programming
Constants and variables in c programming
 
Chap 1 and 2
Chap 1 and 2Chap 1 and 2
Chap 1 and 2
 
C material
C materialC material
C material
 
Lecture 2 variables
Lecture 2 variablesLecture 2 variables
Lecture 2 variables
 
Variables and data types in C++
Variables and data types in C++Variables and data types in C++
Variables and data types in C++
 
C Token’s
C Token’sC Token’s
C Token’s
 
Presentation of c2
Presentation of c2Presentation of c2
Presentation of c2
 

Similar to Basics of c

Basics of C
Basics of CBasics of C
Basics of Cpksahoo9
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt8759000398
 
C PROGRAMMING LANGUAGE.pptx
 C PROGRAMMING LANGUAGE.pptx C PROGRAMMING LANGUAGE.pptx
C PROGRAMMING LANGUAGE.pptxAnshSrivastava48
 
INTRODUCTION TO C++.pptx
INTRODUCTION TO C++.pptxINTRODUCTION TO C++.pptx
INTRODUCTION TO C++.pptxMamataAnilgod
 
C programming tutorial for Beginner
C programming tutorial for BeginnerC programming tutorial for Beginner
C programming tutorial for Beginnersophoeutsen2
 
MCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit Dubey
MCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit DubeyMCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit Dubey
MCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit Dubeykiranrajat
 
CP c++ programing project Unit 1 intro.pdf
CP c++ programing project  Unit 1 intro.pdfCP c++ programing project  Unit 1 intro.pdf
CP c++ programing project Unit 1 intro.pdfShivamYadav886008
 
Data structure & Algorithms - Programming in C
Data structure & Algorithms - Programming in CData structure & Algorithms - Programming in C
Data structure & Algorithms - Programming in Cbabuk110
 

Similar to Basics of c (20)

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
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
 
Basics of C
Basics of CBasics of C
Basics of 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
 
SPC Unit 2
SPC Unit 2SPC Unit 2
SPC Unit 2
 
Basic Of C language
Basic Of C languageBasic Of C language
Basic Of C language
 
C PROGRAMMING LANGUAGE.pptx
 C PROGRAMMING LANGUAGE.pptx C PROGRAMMING LANGUAGE.pptx
C PROGRAMMING LANGUAGE.pptx
 
INTRODUCTION TO C++.pptx
INTRODUCTION TO C++.pptxINTRODUCTION TO C++.pptx
INTRODUCTION TO C++.pptx
 
Lecture 2
Lecture 2Lecture 2
Lecture 2
 
C programming tutorial for Beginner
C programming tutorial for BeginnerC programming tutorial for Beginner
C programming tutorial for Beginner
 
C introduction
C introductionC introduction
C introduction
 
All C ppt.ppt
All C ppt.pptAll C ppt.ppt
All C ppt.ppt
 
MCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit Dubey
MCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit DubeyMCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit Dubey
MCA 101-Programming in C with Data Structure UNIT I by Prof. Rohit Dubey
 
CP c++ programing project Unit 1 intro.pdf
CP c++ programing project  Unit 1 intro.pdfCP c++ programing project  Unit 1 intro.pdf
CP c++ programing project Unit 1 intro.pdf
 
Data structure & Algorithms - Programming in C
Data structure & Algorithms - Programming in CData structure & Algorithms - Programming in C
Data structure & Algorithms - Programming in C
 
C language ppt
C language pptC language ppt
C language ppt
 

Recently uploaded

Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 

Recently uploaded (20)

Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 

Basics of c

  • 1. Basics of ‘C’ By Gaikwad Varsha P. Asst. Prof. Information Technology Dept. Govt. College of Engg. Aurangabad
  • 2. General Aspect of ‘C’ C was originally developed in the 1970s, by Dennis Ritchie at Bell Telephone Laboratories, Inc. C is a High level , general –purpose structured programming language. Instructions of C consists of terms that are very closely same to algebraic expressions, consisting of certain English keywords such as if, else, for ,do and while C contains certain additional features that allows it to be used at a lower level , acting as bridge between machine language and the high level languages. This allows C to be used for system programming as well as for applications programming
  • 3. The Character set of ‘C’ C language consist of some characters set, numbers and some special symbols. The character set of C consist of all the alphabets of English language. C consist of Alphabets a to z, A to Z Numeric 0,1 to 9 Special Symbols {,},[,],?,+,-,*,/,%,!,;,and more The words formed from the character set are building blocks of C and are sometimes known as tokens. These tokens represent the individual entity of language. The following different types of token are used in C 1) Identifiers 2)Keywords 3)Constants 4) Operators 5)Punctuation Symbols
  • 4. Identifiers • A 'C' program consist of two types of elements , user defined and system defined. Idetifiers is nothing but a name given to these eleme • nts. • An identifier is a word used by a programmer to name a variable , function, or label. • identifiers consist of letters and digits, in any order, except that the first charecter or lable. • Identifiers consist of letters and digits if any order,except that the first charecter must be letter. • Both Upper and lowercase letters can be used
  • 5. Keywords • Keywords are nothing but system defined identifiers. • Keywords are reserved words of the language. • They have specific meaning in the language and cannot be used by the programmer as variable or constant names • C is case senitive, it means these must be used as it is • 32 Keywords in C Programming 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
  • 6. Variables • A variable is nothing but a name given to a storage area that our programs can manipulate. Each variable in C has a specific type, which determines the size and layout of the variable's memory; the range of values that can be stored within that memory; and the set of operations that can be applied to the variable. • The name of a variable can be composed of letters, digits, and the underscore character. It must begin with either a letter or an underscore. Upper and lowercase letters are distinct because C is case-sensitive. There are following basic variable types − Type Description • char Typically a single octet(one byte). This is an integer type. • int The most natural size of integer for the machine. • float A single-precision floating point value. • double A double-precision floating point value. • void Represents the absence of type.
  • 7. Constants • A constant is a value or an identifier whose value cannot be altered in a program. For example: 1, 2.5, • As mentioned, an identifier also can be defined as a constant. eg. const double PI = 3.14 • Here, PI is a constant. Basically what it means is that, PI and 3.14 is same for this program. Integer constants • A integer constant is a numeric constant (associated with number) without any fractional or exponential part. There are three types of integer constants in C programming: • decimal constant(base 10) • octal constant(base 8) • hexadecimal constant(base 16)
  • 8. Constants Floating-point constants • A floating point constant is a numeric constant that has either a fractional form or an exponent form. For example: 2.0,0.0000234,-0.22E-5 Character constants • A character constant is a constant which uses single quotation around characters. For example: 'a', 'l', 'm', 'F' String constants • String constants are the constants which are enclosed in a pair of double-quote marks. For example: "good" ,"x","Earth is roundn"
  • 9. Escape Sequences Sometimes, it is necessary to use characters which cannot be typed or has special meaning in C programming. For example: newline(enter), tab, question mark etc. In order to use these characters, escape sequence is used. • For example: n is used for newline. The backslash ( ) causes "escape" from the normal way the characters are interpreted by the compiler.Escape Sequences Character • b Backspace • f Form feed • n Newline • r Return • t Horizontal tab • v Vertical tab • Backslash • ' Single quotation mark • " Double quotation mark • ? Question mark • 0 Null character
  • 10. Operators in C:An operator is a symbol which operates on a value or a variable. For example: + is an operator to perform addition. C programming has wide range of operators to perform various operations. For better understanding of operators, these operators can be classified as: • Arithmetic Operators • Increment and Decrement Operators • Assignment Operators • Relational Operators • Logical Operators • Conditional Operators • Bitwise Operators • Special Operators
  • 11. Arithmetic Operator • Operator Meaning of Operator • + addition or unary plus • - subtraction or unary minus • * multiplication • / division • % remainder after division( modulo division)
  • 12. Increment and Decrement Operators 1. C programming has two operators increment ++ and decrement -- to change the value of an operand (constant or variable) by 1. 2. Increment ++ increases the value by 1 whereas decrement -- decreases the value by 1. 3. These two operators are unary operators, meaning they only operate on a single operand. eg. int a=10, b=100 ++a = 11 --b = 99
  • 13. C Assignment Operators • An assignment operator is used for assigning a value to a variable. The most common assignment operator is = • Operator Example Same as • = a = b a = b • += a += b a = a+b • -= a -= b a = a-b • *= a *= b a = a*b • /= a /= b a = a/b • %= a %= b a = a%b
  • 14. C Relational Operators • A relational operator checks the relationship between two operands. If the relation is true, it returns 1; if the relation is false, it returns value 0. • Relational operators are used in decision making and loops. Operator Meaning of Operator Example • == Equal to 5 == 3 returns 0 • > Greater than 5 > 3 returns 1 • < Less than 5 < 3 returns 0 • != Not equal to 5 != 3 returns 1 • >= Greater than or equal to 5 >= 3 returns 1 • <= Less than or equal to 5 <= 3 return 0