SlideShare a Scribd company logo
By Gaikwad Varsha P.
Asst. Prof. Information Technology Dept.
Govt. College of Engg. Aurangabad
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
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)
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 to5 <= 3 return 0
Ad

More Related Content

What's hot (20)

C presentation book
C presentation bookC presentation book
C presentation book
krunal1210
 
Introduction of c_language
Introduction of c_languageIntroduction of c_language
Introduction of c_language
SINGH PROJECTS
 
Basic of c language
Basic of c languageBasic of c language
Basic of c language
sunilchute1
 
Constant, variables, data types
Constant, variables, data typesConstant, variables, data types
Constant, variables, data types
Pratik Devmurari
 
5 introduction-to-c
5 introduction-to-c5 introduction-to-c
5 introduction-to-c
Rohit Shrivastava
 
Lecture02(constants, variable & data types)
Lecture02(constants, variable & data types)Lecture02(constants, variable & data types)
Lecture02(constants, variable & data types)
Dhaka University of Engineering & Technology(DUET)
 
Chapter3
Chapter3Chapter3
Chapter3
Kamran
 
Constant and variacles in c
Constant   and variacles in cConstant   and variacles in c
Constant and variacles in c
yash patel
 
1. introduction to computer
1. introduction to computer1. introduction to computer
1. introduction to computer
Shankar Gangaju
 
INTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMINGINTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMING
Abhishek Dwivedi
 
Btech i pic u-2 datatypes and variables in c language
Btech i pic u-2 datatypes and variables in c languageBtech i pic u-2 datatypes and variables in c language
Btech i pic u-2 datatypes and variables in c language
Rai University
 
Mca i pic u-2 datatypes and variables in c language
Mca i pic u-2 datatypes and variables in c languageMca i pic u-2 datatypes and variables in c language
Mca i pic u-2 datatypes and variables in c language
Rai University
 
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
Kamal Acharya
 
Operators in C Programming
Operators in C ProgrammingOperators in C Programming
Operators in C Programming
Qazi Shahzad Ali
 
Session02 c intro
Session02 c introSession02 c intro
Session02 c intro
HarithaRanasinghe
 
C language
C language C language
C language
COMSATS Institute of Information Technology
 
C language (Collected By Dushmanta)
C language  (Collected By Dushmanta)C language  (Collected By Dushmanta)
C language (Collected By Dushmanta)
Dushmanta Nath
 
C prog ppt
C prog pptC prog ppt
C prog ppt
xinoe
 
Chaptr 1
Chaptr 1Chaptr 1
Chaptr 1
Maha lakshmi
 
Chap 1 and 2
Chap 1 and 2Chap 1 and 2
Chap 1 and 2
Selva Arrunaa Mathavan
 

Similar to Basics of c (20)

Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
Ashwini Rao
 
Introduction to Programming Concepts Algorithm Flowchart Introduction to C...
Introduction to Programming Concepts  Algorithm  Flowchart  Introduction to C...Introduction to Programming Concepts  Algorithm  Flowchart  Introduction to C...
Introduction to Programming Concepts Algorithm Flowchart Introduction to C...
anuragsinghrajput252
 
Basics of C programming power point presentation
Basics of C programming power point presentationBasics of C programming power point presentation
Basics of C programming power point presentation
thoratgauri97
 
Basics of C.ppt,...................................
Basics of C.ppt,...................................Basics of C.ppt,...................................
Basics of C.ppt,...................................
taywadebhagyashree2
 
C programming and problem solving for real time solution
C programming and problem solving for real time solutionC programming and problem solving for real time solution
C programming and problem solving for real time solution
Chaitanya Jambotkar
 
Programming in C-To study basics of C programming Language.
Programming in C-To study basics of C programming Language.Programming in C-To study basics of C programming Language.
Programming in C-To study basics of C programming Language.
nrathinakumar12
 
Basics of C.ppt VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
Basics of C.ppt  VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVBasics of C.ppt  VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
Basics of C.ppt VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
NagarathnaRajur2
 
Basics of C programming concept and type
Basics of C programming concept and  typeBasics of C programming concept and  type
Basics of C programming concept and type
baisakhiparida92
 
Basics of C programming powerpoint p.ppt
Basics of C programming powerpoint p.pptBasics of C programming powerpoint p.ppt
Basics of C programming powerpoint p.ppt
Thilagavathi N
 
Basics of C.pptArray.pptxArray.pptxArray.pptx
Basics of C.pptArray.pptxArray.pptxArray.pptxBasics of C.pptArray.pptxArray.pptxArray.pptx
Basics of C.pptArray.pptxArray.pptxArray.pptx
yatakumar84
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
TanuGohel
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
ssuserc8fc691
 
Funa-C.ppt
Funa-C.pptFuna-C.ppt
Funa-C.ppt
ssuser5ad1571
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
MEHALAS3
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
kabhinavin
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
nikitha992646
 
Basiscs of c++ include variable, special characters
Basiscs of c++ include variable, special charactersBasiscs of c++ include variable, special characters
Basiscs of c++ include variable, special characters
E.M.G.yadava womens college
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
KrishKumar690406
 
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
 
Introduction to Programming Concepts Algorithm Flowchart Introduction to C...
Introduction to Programming Concepts  Algorithm  Flowchart  Introduction to C...Introduction to Programming Concepts  Algorithm  Flowchart  Introduction to C...
Introduction to Programming Concepts Algorithm Flowchart Introduction to C...
anuragsinghrajput252
 
Basics of C programming power point presentation
Basics of C programming power point presentationBasics of C programming power point presentation
Basics of C programming power point presentation
thoratgauri97
 
Basics of C.ppt,...................................
Basics of C.ppt,...................................Basics of C.ppt,...................................
Basics of C.ppt,...................................
taywadebhagyashree2
 
C programming and problem solving for real time solution
C programming and problem solving for real time solutionC programming and problem solving for real time solution
C programming and problem solving for real time solution
Chaitanya Jambotkar
 
Programming in C-To study basics of C programming Language.
Programming in C-To study basics of C programming Language.Programming in C-To study basics of C programming Language.
Programming in C-To study basics of C programming Language.
nrathinakumar12
 
Basics of C.ppt VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
Basics of C.ppt  VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVBasics of C.ppt  VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
Basics of C.ppt VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
NagarathnaRajur2
 
Basics of C programming concept and type
Basics of C programming concept and  typeBasics of C programming concept and  type
Basics of C programming concept and type
baisakhiparida92
 
Basics of C programming powerpoint p.ppt
Basics of C programming powerpoint p.pptBasics of C programming powerpoint p.ppt
Basics of C programming powerpoint p.ppt
Thilagavathi N
 
Basics of C.pptArray.pptxArray.pptxArray.pptx
Basics of C.pptArray.pptxArray.pptxArray.pptxBasics of C.pptArray.pptxArray.pptxArray.pptx
Basics of C.pptArray.pptxArray.pptxArray.pptx
yatakumar84
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
TanuGohel
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
MEHALAS3
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
kabhinavin
 
Basiscs of c++ include variable, special characters
Basiscs of c++ include variable, special charactersBasiscs of c++ include variable, special characters
Basiscs of c++ include variable, special characters
E.M.G.yadava womens college
 
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
 
Ad

Recently uploaded (20)

Anti-Depressants pharmacology 1slide.pptx
Anti-Depressants pharmacology 1slide.pptxAnti-Depressants pharmacology 1slide.pptx
Anti-Depressants pharmacology 1slide.pptx
Mayuri Chavan
 
How to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 WebsiteHow to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 Website
Celine George
 
Operations Management (Dr. Abdulfatah Salem).pdf
Operations Management (Dr. Abdulfatah Salem).pdfOperations Management (Dr. Abdulfatah Salem).pdf
Operations Management (Dr. Abdulfatah Salem).pdf
Arab Academy for Science, Technology and Maritime Transport
 
LDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini UpdatesLDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini Updates
LDM Mia eStudios
 
Quality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdfQuality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdf
Dr. Bindiya Chauhan
 
Presentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem KayaPresentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulsepulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
sushreesangita003
 
2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx
contactwilliamm2546
 
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Celine George
 
SPRING FESTIVITIES - UK AND USA -
SPRING FESTIVITIES - UK AND USA            -SPRING FESTIVITIES - UK AND USA            -
SPRING FESTIVITIES - UK AND USA -
Colégio Santa Teresinha
 
The ever evoilving world of science /7th class science curiosity /samyans aca...
The ever evoilving world of science /7th class science curiosity /samyans aca...The ever evoilving world of science /7th class science curiosity /samyans aca...
The ever evoilving world of science /7th class science curiosity /samyans aca...
Sandeep Swamy
 
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar RabbiPresentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Md Shaifullar Rabbi
 
Political History of Pala dynasty Pala Rulers NEP.pptx
Political History of Pala dynasty Pala Rulers NEP.pptxPolitical History of Pala dynasty Pala Rulers NEP.pptx
Political History of Pala dynasty Pala Rulers NEP.pptx
Arya Mahila P. G. College, Banaras Hindu University, Varanasi, India.
 
To study Digestive system of insect.pptx
To study Digestive system of insect.pptxTo study Digestive system of insect.pptx
To study Digestive system of insect.pptx
Arshad Shaikh
 
Ultimate VMware 2V0-11.25 Exam Dumps for Exam Success
Ultimate VMware 2V0-11.25 Exam Dumps for Exam SuccessUltimate VMware 2V0-11.25 Exam Dumps for Exam Success
Ultimate VMware 2V0-11.25 Exam Dumps for Exam Success
Mark Soia
 
New Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptxNew Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptx
milanasargsyan5
 
Understanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s GuideUnderstanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s Guide
GS Virdi
 
How to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POSHow to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POS
Celine George
 
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
Celine George
 
P-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 finalP-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 final
bs22n2s
 
Anti-Depressants pharmacology 1slide.pptx
Anti-Depressants pharmacology 1slide.pptxAnti-Depressants pharmacology 1slide.pptx
Anti-Depressants pharmacology 1slide.pptx
Mayuri Chavan
 
How to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 WebsiteHow to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 Website
Celine George
 
LDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini UpdatesLDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini Updates
LDM Mia eStudios
 
Quality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdfQuality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdf
Dr. Bindiya Chauhan
 
Presentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem KayaPresentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulsepulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
sushreesangita003
 
2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx
contactwilliamm2546
 
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Celine George
 
The ever evoilving world of science /7th class science curiosity /samyans aca...
The ever evoilving world of science /7th class science curiosity /samyans aca...The ever evoilving world of science /7th class science curiosity /samyans aca...
The ever evoilving world of science /7th class science curiosity /samyans aca...
Sandeep Swamy
 
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar RabbiPresentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Md Shaifullar Rabbi
 
To study Digestive system of insect.pptx
To study Digestive system of insect.pptxTo study Digestive system of insect.pptx
To study Digestive system of insect.pptx
Arshad Shaikh
 
Ultimate VMware 2V0-11.25 Exam Dumps for Exam Success
Ultimate VMware 2V0-11.25 Exam Dumps for Exam SuccessUltimate VMware 2V0-11.25 Exam Dumps for Exam Success
Ultimate VMware 2V0-11.25 Exam Dumps for Exam Success
Mark Soia
 
New Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptxNew Microsoft PowerPoint Presentation.pptx
New Microsoft PowerPoint Presentation.pptx
milanasargsyan5
 
Understanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s GuideUnderstanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s Guide
GS Virdi
 
How to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POSHow to Manage Opening & Closing Controls in Odoo 17 POS
How to Manage Opening & Closing Controls in Odoo 17 POS
Celine George
 
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
Celine George
 
P-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 finalP-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 final
bs22n2s
 
Ad

Basics of c

  • 1. By Gaikwad Varsha P. Asst. Prof. Information Technology Dept. Govt. College of Engg. Aurangabad
  • 2. 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. 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. 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 to5 <= 3 return 0