SlideShare a Scribd company logo
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 c
an 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 sto
red 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 undersco
re character. It must begin with either a letter or an underscore. Upper and l
owercase letters are distinct because C is case-sensitive. There are followi
ng 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 al
tered 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 e
ither 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 quo
tation 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 sp
ecial 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" fro
m 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 wherea
s decrement -- decreases the value by 1.
3. These two operators are unary operators, mea
ning 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 v
alue to a variable. The most common assignmen
t 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 tw
o operands. If the relation is true, it returns 1; if the relati
on is false, it returns value 0.
• Relational operators are used in decision making and loo
ps.
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
Ad

More Related Content

Similar to Basics of C.pptArray.pptxArray.pptxArray.pptx (20)

Basics of C--C Basics------------------.ppt
Basics of C--C Basics------------------.pptBasics of C--C Basics------------------.ppt
Basics of C--C Basics------------------.ppt
Ravi Chandra Medisetty
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
MITSINDHAV2
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
kiran833055
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
ChiranjeevivarmaP
 
Basics of C (1).ppt
Basics of C (1).pptBasics of C (1).ppt
Basics of C (1).ppt
SteveIrwin25
 
Basics of C (1).ppt
Basics of C (1).pptBasics of C (1).ppt
Basics of C (1).ppt
HeshamMohamed855920
 
C programming basic pdf.ppt
C programming basic pdf.pptC programming basic pdf.ppt
C programming basic pdf.ppt
KauserJahan6
 
Basics of c
Basics of cBasics of c
Basics of c
Saidaiah Bandi
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
SangramNayak23
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
SeethaDinesh
 
Basics of C in details all concept are implemented..
Basics of C in details all concept are implemented..Basics of C in details all concept are implemented..
Basics of C in details all concept are implemented..
DipakKadam22
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
gprasannakumarPrasan
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
RohanJoshi290109
 
Basics of C
Basics of CBasics of C
Basics of C
pksahoo9
 
Introduction of Basics of c programming.pptx
Introduction of Basics of c programming.pptxIntroduction of Basics of c programming.pptx
Introduction of Basics of c programming.pptx
priyankabonde1998
 
Basic of c language
Basic of c languageBasic of c language
Basic of c language
sunilchute1
 
M.Florence Dayana / Basics of C Language
M.Florence Dayana / Basics of C LanguageM.Florence Dayana / Basics of C Language
M.Florence Dayana / Basics of C Language
Dr.Florence Dayana
 
Basics of c
Basics of cBasics of c
Basics of c
vinothini1996
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
Ashwini Rao
 
Basics of C Programming Language Introduction.pptx
Basics of C Programming Language Introduction.pptxBasics of C Programming Language Introduction.pptx
Basics of C Programming Language Introduction.pptx
foxel54542
 
Basics of C--C Basics------------------.ppt
Basics of C--C Basics------------------.pptBasics of C--C Basics------------------.ppt
Basics of C--C Basics------------------.ppt
Ravi Chandra Medisetty
 
Basics of C (1).ppt
Basics of C (1).pptBasics of C (1).ppt
Basics of C (1).ppt
SteveIrwin25
 
C programming basic pdf.ppt
C programming basic pdf.pptC programming basic pdf.ppt
C programming basic pdf.ppt
KauserJahan6
 
Basics of C in details all concept are implemented..
Basics of C in details all concept are implemented..Basics of C in details all concept are implemented..
Basics of C in details all concept are implemented..
DipakKadam22
 
Basics of C
Basics of CBasics of C
Basics of C
pksahoo9
 
Introduction of Basics of c programming.pptx
Introduction of Basics of c programming.pptxIntroduction of Basics of c programming.pptx
Introduction of Basics of c programming.pptx
priyankabonde1998
 
Basic of c language
Basic of c languageBasic of c language
Basic of c language
sunilchute1
 
M.Florence Dayana / Basics of C Language
M.Florence Dayana / Basics of C LanguageM.Florence Dayana / Basics of C Language
M.Florence Dayana / Basics of C Language
Dr.Florence Dayana
 
Basics of C Programming Language Introduction.pptx
Basics of C Programming Language Introduction.pptxBasics of C Programming Language Introduction.pptx
Basics of C Programming Language Introduction.pptx
foxel54542
 

More from yatakumar84 (6)

Innovation_Creativity_v7.pptxInnovation_Creativity
Innovation_Creativity_v7.pptxInnovation_CreativityInnovation_Creativity_v7.pptxInnovation_Creativity
Innovation_Creativity_v7.pptxInnovation_Creativity
yatakumar84
 
Design_thinking_slidesDesign_thinking_slide_week9.pptx
Design_thinking_slidesDesign_thinking_slide_week9.pptxDesign_thinking_slidesDesign_thinking_slide_week9.pptx
Design_thinking_slidesDesign_thinking_slide_week9.pptx
yatakumar84
 
Teams_leadership_v1.pptxTeams_leadership_v1.pptxTeams_leadership_v1.pptx
Teams_leadership_v1.pptxTeams_leadership_v1.pptxTeams_leadership_v1.pptxTeams_leadership_v1.pptxTeams_leadership_v1.pptxTeams_leadership_v1.pptx
Teams_leadership_v1.pptxTeams_leadership_v1.pptxTeams_leadership_v1.pptx
yatakumar84
 
Innovation_Creativity_v6.pptxInnovation_Creativity_v6.pptxInnovation_Creativi...
Innovation_Creativity_v6.pptxInnovation_Creativity_v6.pptxInnovation_Creativi...Innovation_Creativity_v6.pptxInnovation_Creativity_v6.pptxInnovation_Creativi...
Innovation_Creativity_v6.pptxInnovation_Creativity_v6.pptxInnovation_Creativi...
yatakumar84
 
Chapter02.PPTArray.pptxArray.pptxArray.pptx
Chapter02.PPTArray.pptxArray.pptxArray.pptxChapter02.PPTArray.pptxArray.pptxArray.pptx
Chapter02.PPTArray.pptxArray.pptxArray.pptx
yatakumar84
 
Array.pptx Array.pptxArray.pptx Array.pptxArray.pptxArray.pptx
Array.pptx Array.pptxArray.pptx Array.pptxArray.pptxArray.pptxArray.pptx Array.pptxArray.pptx Array.pptxArray.pptxArray.pptx
Array.pptx Array.pptxArray.pptx Array.pptxArray.pptxArray.pptx
yatakumar84
 
Innovation_Creativity_v7.pptxInnovation_Creativity
Innovation_Creativity_v7.pptxInnovation_CreativityInnovation_Creativity_v7.pptxInnovation_Creativity
Innovation_Creativity_v7.pptxInnovation_Creativity
yatakumar84
 
Design_thinking_slidesDesign_thinking_slide_week9.pptx
Design_thinking_slidesDesign_thinking_slide_week9.pptxDesign_thinking_slidesDesign_thinking_slide_week9.pptx
Design_thinking_slidesDesign_thinking_slide_week9.pptx
yatakumar84
 
Teams_leadership_v1.pptxTeams_leadership_v1.pptxTeams_leadership_v1.pptx
Teams_leadership_v1.pptxTeams_leadership_v1.pptxTeams_leadership_v1.pptxTeams_leadership_v1.pptxTeams_leadership_v1.pptxTeams_leadership_v1.pptx
Teams_leadership_v1.pptxTeams_leadership_v1.pptxTeams_leadership_v1.pptx
yatakumar84
 
Innovation_Creativity_v6.pptxInnovation_Creativity_v6.pptxInnovation_Creativi...
Innovation_Creativity_v6.pptxInnovation_Creativity_v6.pptxInnovation_Creativi...Innovation_Creativity_v6.pptxInnovation_Creativity_v6.pptxInnovation_Creativi...
Innovation_Creativity_v6.pptxInnovation_Creativity_v6.pptxInnovation_Creativi...
yatakumar84
 
Chapter02.PPTArray.pptxArray.pptxArray.pptx
Chapter02.PPTArray.pptxArray.pptxArray.pptxChapter02.PPTArray.pptxArray.pptxArray.pptx
Chapter02.PPTArray.pptxArray.pptxArray.pptx
yatakumar84
 
Array.pptx Array.pptxArray.pptx Array.pptxArray.pptxArray.pptx
Array.pptx Array.pptxArray.pptx Array.pptxArray.pptxArray.pptxArray.pptx Array.pptxArray.pptx Array.pptxArray.pptxArray.pptx
Array.pptx Array.pptxArray.pptx Array.pptxArray.pptxArray.pptx
yatakumar84
 
Ad

Recently uploaded (20)

SAFETY BRIEFING.........................
SAFETY BRIEFING.........................SAFETY BRIEFING.........................
SAFETY BRIEFING.........................
BalaChandran458212
 
Research Project csi1 - This presentation compares popular web browsers such ...
Research Project csi1 - This presentation compares popular web browsers such ...Research Project csi1 - This presentation compares popular web browsers such ...
Research Project csi1 - This presentation compares popular web browsers such ...
bomisung0207
 
RightShip-Inspection-Maritime-Safety-Simplified.pptx
RightShip-Inspection-Maritime-Safety-Simplified.pptxRightShip-Inspection-Maritime-Safety-Simplified.pptx
RightShip-Inspection-Maritime-Safety-Simplified.pptx
ultronmeg
 
Employment Communication : The Job HUnting.pptx
Employment Communication : The Job HUnting.pptxEmployment Communication : The Job HUnting.pptx
Employment Communication : The Job HUnting.pptx
JunaidAlvi5
 
Lecture 4.pptx which is need for microeconomic
Lecture 4.pptx which is need for microeconomicLecture 4.pptx which is need for microeconomic
Lecture 4.pptx which is need for microeconomic
mdrakibhasan1427
 
Huckel_MO_Theory_Colorful_Presentation (1).pptx
Huckel_MO_Theory_Colorful_Presentation (1).pptxHuckel_MO_Theory_Colorful_Presentation (1).pptx
Huckel_MO_Theory_Colorful_Presentation (1).pptx
study2022bsc
 
Green Colorful House Simple Illustration Presentation.pdf.pdf
Green Colorful House Simple Illustration Presentation.pdf.pdfGreen Colorful House Simple Illustration Presentation.pdf.pdf
Green Colorful House Simple Illustration Presentation.pdf.pdf
RhyzCharmSolis
 
Placement cell of college - why choose me
Placement cell of college - why choose mePlacement cell of college - why choose me
Placement cell of college - why choose me
mmanvi024
 
CHAPTER 7 - Foreign Direct Investment.pptx
CHAPTER 7 - Foreign Direct Investment.pptxCHAPTER 7 - Foreign Direct Investment.pptx
CHAPTER 7 - Foreign Direct Investment.pptx
72200337
 
English For Carrier, It enhance your Communication Skills
English For Carrier, It enhance your Communication SkillsEnglish For Carrier, It enhance your Communication Skills
English For Carrier, It enhance your Communication Skills
ankitbeherabiru
 
!Warshauer Paul Curriculum Vitae, Resume
!Warshauer Paul Curriculum Vitae, Resume!Warshauer Paul Curriculum Vitae, Resume
!Warshauer Paul Curriculum Vitae, Resume
PaulWarshauer1
 
Huckel_Molecular orbital _Theory_8_Slides.pptx
Huckel_Molecular orbital _Theory_8_Slides.pptxHuckel_Molecular orbital _Theory_8_Slides.pptx
Huckel_Molecular orbital _Theory_8_Slides.pptx
study2022bsc
 
What's the Volume Quiz Presentation in Green Grey Purple Simple Lined Style (...
What's the Volume Quiz Presentation in Green Grey Purple Simple Lined Style (...What's the Volume Quiz Presentation in Green Grey Purple Simple Lined Style (...
What's the Volume Quiz Presentation in Green Grey Purple Simple Lined Style (...
shenleighmaemolina
 
Bronchitis_Presentation_with_Images.pptx
Bronchitis_Presentation_with_Images.pptxBronchitis_Presentation_with_Images.pptx
Bronchitis_Presentation_with_Images.pptx
monmohanchowdhury8
 
SEMINAR REPORT PPT.pptxSDJADADGGDYSADGSGJSFDH
SEMINAR REPORT PPT.pptxSDJADADGGDYSADGSGJSFDHSEMINAR REPORT PPT.pptxSDJADADGGDYSADGSGJSFDH
SEMINAR REPORT PPT.pptxSDJADADGGDYSADGSGJSFDH
123candemet2003
 
material-17438335 to the third floor in 47-gsms.pptx
material-17438335 to the third floor in 47-gsms.pptxmaterial-17438335 to the third floor in 47-gsms.pptx
material-17438335 to the third floor in 47-gsms.pptx
JyotirmayNirankari
 
巴利亚多利德大学毕业证书学校原版文凭补办UVa成绩单办本科成绩单
巴利亚多利德大学毕业证书学校原版文凭补办UVa成绩单办本科成绩单巴利亚多利德大学毕业证书学校原版文凭补办UVa成绩单办本科成绩单
巴利亚多利德大学毕业证书学校原版文凭补办UVa成绩单办本科成绩单
xule9cv6nd
 
Introduction on Speaking skills Power Point
Introduction on Speaking skills Power PointIntroduction on Speaking skills Power Point
Introduction on Speaking skills Power Point
helenswarna
 
RCM-billing in medical coding0000 1.pptx
RCM-billing in medical coding0000 1.pptxRCM-billing in medical coding0000 1.pptx
RCM-billing in medical coding0000 1.pptx
liajohn0808
 
For ssrvm school Admission Campaign.pptx
For ssrvm school Admission Campaign.pptxFor ssrvm school Admission Campaign.pptx
For ssrvm school Admission Campaign.pptx
ArunTYltp
 
SAFETY BRIEFING.........................
SAFETY BRIEFING.........................SAFETY BRIEFING.........................
SAFETY BRIEFING.........................
BalaChandran458212
 
Research Project csi1 - This presentation compares popular web browsers such ...
Research Project csi1 - This presentation compares popular web browsers such ...Research Project csi1 - This presentation compares popular web browsers such ...
Research Project csi1 - This presentation compares popular web browsers such ...
bomisung0207
 
RightShip-Inspection-Maritime-Safety-Simplified.pptx
RightShip-Inspection-Maritime-Safety-Simplified.pptxRightShip-Inspection-Maritime-Safety-Simplified.pptx
RightShip-Inspection-Maritime-Safety-Simplified.pptx
ultronmeg
 
Employment Communication : The Job HUnting.pptx
Employment Communication : The Job HUnting.pptxEmployment Communication : The Job HUnting.pptx
Employment Communication : The Job HUnting.pptx
JunaidAlvi5
 
Lecture 4.pptx which is need for microeconomic
Lecture 4.pptx which is need for microeconomicLecture 4.pptx which is need for microeconomic
Lecture 4.pptx which is need for microeconomic
mdrakibhasan1427
 
Huckel_MO_Theory_Colorful_Presentation (1).pptx
Huckel_MO_Theory_Colorful_Presentation (1).pptxHuckel_MO_Theory_Colorful_Presentation (1).pptx
Huckel_MO_Theory_Colorful_Presentation (1).pptx
study2022bsc
 
Green Colorful House Simple Illustration Presentation.pdf.pdf
Green Colorful House Simple Illustration Presentation.pdf.pdfGreen Colorful House Simple Illustration Presentation.pdf.pdf
Green Colorful House Simple Illustration Presentation.pdf.pdf
RhyzCharmSolis
 
Placement cell of college - why choose me
Placement cell of college - why choose mePlacement cell of college - why choose me
Placement cell of college - why choose me
mmanvi024
 
CHAPTER 7 - Foreign Direct Investment.pptx
CHAPTER 7 - Foreign Direct Investment.pptxCHAPTER 7 - Foreign Direct Investment.pptx
CHAPTER 7 - Foreign Direct Investment.pptx
72200337
 
English For Carrier, It enhance your Communication Skills
English For Carrier, It enhance your Communication SkillsEnglish For Carrier, It enhance your Communication Skills
English For Carrier, It enhance your Communication Skills
ankitbeherabiru
 
!Warshauer Paul Curriculum Vitae, Resume
!Warshauer Paul Curriculum Vitae, Resume!Warshauer Paul Curriculum Vitae, Resume
!Warshauer Paul Curriculum Vitae, Resume
PaulWarshauer1
 
Huckel_Molecular orbital _Theory_8_Slides.pptx
Huckel_Molecular orbital _Theory_8_Slides.pptxHuckel_Molecular orbital _Theory_8_Slides.pptx
Huckel_Molecular orbital _Theory_8_Slides.pptx
study2022bsc
 
What's the Volume Quiz Presentation in Green Grey Purple Simple Lined Style (...
What's the Volume Quiz Presentation in Green Grey Purple Simple Lined Style (...What's the Volume Quiz Presentation in Green Grey Purple Simple Lined Style (...
What's the Volume Quiz Presentation in Green Grey Purple Simple Lined Style (...
shenleighmaemolina
 
Bronchitis_Presentation_with_Images.pptx
Bronchitis_Presentation_with_Images.pptxBronchitis_Presentation_with_Images.pptx
Bronchitis_Presentation_with_Images.pptx
monmohanchowdhury8
 
SEMINAR REPORT PPT.pptxSDJADADGGDYSADGSGJSFDH
SEMINAR REPORT PPT.pptxSDJADADGGDYSADGSGJSFDHSEMINAR REPORT PPT.pptxSDJADADGGDYSADGSGJSFDH
SEMINAR REPORT PPT.pptxSDJADADGGDYSADGSGJSFDH
123candemet2003
 
material-17438335 to the third floor in 47-gsms.pptx
material-17438335 to the third floor in 47-gsms.pptxmaterial-17438335 to the third floor in 47-gsms.pptx
material-17438335 to the third floor in 47-gsms.pptx
JyotirmayNirankari
 
巴利亚多利德大学毕业证书学校原版文凭补办UVa成绩单办本科成绩单
巴利亚多利德大学毕业证书学校原版文凭补办UVa成绩单办本科成绩单巴利亚多利德大学毕业证书学校原版文凭补办UVa成绩单办本科成绩单
巴利亚多利德大学毕业证书学校原版文凭补办UVa成绩单办本科成绩单
xule9cv6nd
 
Introduction on Speaking skills Power Point
Introduction on Speaking skills Power PointIntroduction on Speaking skills Power Point
Introduction on Speaking skills Power Point
helenswarna
 
RCM-billing in medical coding0000 1.pptx
RCM-billing in medical coding0000 1.pptxRCM-billing in medical coding0000 1.pptx
RCM-billing in medical coding0000 1.pptx
liajohn0808
 
For ssrvm school Admission Campaign.pptx
For ssrvm school Admission Campaign.pptxFor ssrvm school Admission Campaign.pptx
For ssrvm school Admission Campaign.pptx
ArunTYltp
 
Ad

Basics of C.pptArray.pptxArray.pptxArray.pptx

  • 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 c an 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 sto red 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 undersco re character. It must begin with either a letter or an underscore. Upper and l owercase letters are distinct because C is case-sensitive. There are followi ng 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 al tered 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 e ither 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 quo tation 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 sp ecial 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" fro m 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 wherea s decrement -- decreases the value by 1. 3. These two operators are unary operators, mea ning 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 v alue to a variable. The most common assignmen t 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 tw o operands. If the relation is true, it returns 1; if the relati on is false, it returns value 0. • Relational operators are used in decision making and loo ps. 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