SlideShare ist ein Scribd-Unternehmen logo
1 von 25
Presented By : BINAY TAMANG
Introduction
• C is a general purpose programming language.
• It is a very popular and most widely used programming
language.
• Many of the important ideas of C are being brought
from the BPCL language.
• C programming is considered as the base for other
programming languages, that is why it is known as
mother language.
• C is strongly associated with UNIX, as it was
developed to write the UNIX operating system.
History
• C programming language was developed in 1972 by Dennis Ritchie at bell
laboratories of AT&T (American Telephone & Telegraph), located in the U.S.A.
• Dennis Ritchie is known as the founder of the c language.
• It was developed to overcome the problems of previous languages such as B, BCPL,
etc.
• Initially, C language was developed to be used in UNIX operating system. It inherits
many features of previous languages such as B and BCPL.
• Let's see the programming languages that were developed before C language.
Language Year Developed By
Algol 1960 International Group
BCPL 1967 Martin Richard
B 1970 Ken Thompson
Traditional C 1972 Dennis Ritchie
K & R C 1978 Kernighan & Dennis Ritchie
ANSI C 1989 ANSI Committee
ANSI/ISO C 1990 ISO Committee
C99 1999 Standardization Committee
Features
C is the widely used language. It provides many features that are
given below.
• Simple
• Procedural programming language
• structured programming language
• Rich Library
• Memory Management
• Fast Speed
• Pointers
• Recursion
Get started with C?
• Get Started With C
• To start using C, you need two things:
• A text editor, like Notepad, to write C code
• A compiler, like Turbo C++, Code Blocks, to translate the C code into a language
that the computer will understand.
• There are many text editors and compilers to choose from. Here, we will use
an IDE (see below).
• An IDE (Integrated Development Environment) is used to edit AND compile the
code.
• Note: Web-based IDE's can work as well, but functionality is limited.
• We will use Turbo C++ which we believe is a good place to start.
• You can find the latest version of Turbo C++
at https://developerinsider.co/download-turbo-c-for-windows-7-8-8-1-and-
windows-10-32-64-bit-full-screen/ . Download setup.exe file, which will install the
text editor with a compiler.
Structure of C program
Before writing program in C, we need to have a basic
knowledge in the following.
Character set.
and
Tokens
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
following different types of token are used in C
1) Identifiers 2)Keywords 3)Constants
4) Operators 5)Punctuation Symbols
Tokens
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
Identifiers
• A 'C' program consist of two types of elements , user
defined and system defined. Identifiers is nothing but a
name given to these elements.
• 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 character or label.
• 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 sensitive, 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
Data Types in C
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
Operators
Arithmetic Operator
Arithmetic Operators
Arithmetic operators are used to perform common mathematical operations.
Operator Name Description Example Try it
+ Addition Adds together two values x + y Try it »
- Subtraction Subtracts one value from another x - y Try it »
* Multiplication Multiplies two values x * y Try it »
/ Division Divides one value by another x / y Try it »
% Modulus Returns the division remainder x % y Try it »
++ Increment Increases the value of a variable by 1 ++x Try it »
-- Decrement Decreases the value of a variable by 1 --x
Increment and Decrement Operator
The decrement (–) and increment (++) operators are special types of operators used in
programming languages to decrement and increment the value of the given variable by
1 (one), respectively.
Types of Increment and Decrement Operators in C
Following types of increment and decrement operators are found in the C language:
Prefix Increment operator
Prefix Decrement operator
Postfix Increment operator
Postfix Decrement operator
Increment Operators
We use increment operators in C to increment the given value of a variable by 1.
For instance,
int a = 1, b = 1;
++b; // valid
++3; // invalid – increment operator is operating on constant value
++(a+b); // invalid – increment operator is operating on expression
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
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

Weitere ähnliche Inhalte

Ähnlich wie C Programming Introduction

Ähnlich wie C Programming Introduction (20)

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
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
 
Basics of C--C Basics------------------.ppt
Basics of C--C Basics------------------.pptBasics of C--C Basics------------------.ppt
Basics of C--C Basics------------------.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 (1).ppt
Basics of C (1).pptBasics of C (1).ppt
Basics of C (1).ppt
 
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
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
 
Basic of c language
Basic of c languageBasic of c language
Basic of c language
 
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
 
#Code2 create c++ for beginners
#Code2 create  c++ for beginners #Code2 create  c++ for beginners
#Code2 create c++ for beginners
 
Introduction to C
Introduction to CIntroduction to C
Introduction to C
 
C language unit-1
C language unit-1C language unit-1
C language unit-1
 
C LANGUAGE UNIT-1 PREPARED BY M V BRAHMANANDA REDDY
C LANGUAGE UNIT-1 PREPARED BY M V BRAHMANANDA REDDYC LANGUAGE UNIT-1 PREPARED BY M V BRAHMANANDA REDDY
C LANGUAGE UNIT-1 PREPARED BY M V BRAHMANANDA REDDY
 
C languaGE UNIT-1
C languaGE UNIT-1C languaGE UNIT-1
C languaGE UNIT-1
 

Mehr von 8759000398

COMPUTER WINDOWS AND ITS LAB ASSESSMENT.docx
COMPUTER WINDOWS AND ITS LAB ASSESSMENT.docxCOMPUTER WINDOWS AND ITS LAB ASSESSMENT.docx
COMPUTER WINDOWS AND ITS LAB ASSESSMENT.docx8759000398
 
Testing in Software Engineering.docx
Testing in Software Engineering.docxTesting in Software Engineering.docx
Testing in Software Engineering.docx8759000398
 
SAD_UnitII.docx
SAD_UnitII.docxSAD_UnitII.docx
SAD_UnitII.docx8759000398
 
JavaScript Date Objects.docx
JavaScript Date Objects.docxJavaScript Date Objects.docx
JavaScript Date Objects.docx8759000398
 
C Programming Strings.docx
C Programming Strings.docxC Programming Strings.docx
C Programming Strings.docx8759000398
 
Nursing Infromatics.pptx
Nursing Infromatics.pptxNursing Infromatics.pptx
Nursing Infromatics.pptx8759000398
 
College app for android device
College app for android deviceCollege app for android device
College app for android device8759000398
 

Mehr von 8759000398 (9)

COMPUTER WINDOWS AND ITS LAB ASSESSMENT.docx
COMPUTER WINDOWS AND ITS LAB ASSESSMENT.docxCOMPUTER WINDOWS AND ITS LAB ASSESSMENT.docx
COMPUTER WINDOWS AND ITS LAB ASSESSMENT.docx
 
Testing in Software Engineering.docx
Testing in Software Engineering.docxTesting in Software Engineering.docx
Testing in Software Engineering.docx
 
SAD_UnitII.docx
SAD_UnitII.docxSAD_UnitII.docx
SAD_UnitII.docx
 
JavaScript Date Objects.docx
JavaScript Date Objects.docxJavaScript Date Objects.docx
JavaScript Date Objects.docx
 
C Programming Strings.docx
C Programming Strings.docxC Programming Strings.docx
C Programming Strings.docx
 
Nursing Infromatics.pptx
Nursing Infromatics.pptxNursing Infromatics.pptx
Nursing Infromatics.pptx
 
newone2.pdf
newone2.pdfnewone2.pdf
newone2.pdf
 
College app for android device
College app for android deviceCollege app for android device
College app for android device
 
Android
AndroidAndroid
Android
 

Kürzlich hochgeladen

1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 

Kürzlich hochgeladen (20)

1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 

C Programming Introduction

  • 1. Presented By : BINAY TAMANG
  • 2. Introduction • C is a general purpose programming language. • It is a very popular and most widely used programming language. • Many of the important ideas of C are being brought from the BPCL language. • C programming is considered as the base for other programming languages, that is why it is known as mother language. • C is strongly associated with UNIX, as it was developed to write the UNIX operating system.
  • 3. History • C programming language was developed in 1972 by Dennis Ritchie at bell laboratories of AT&T (American Telephone & Telegraph), located in the U.S.A. • Dennis Ritchie is known as the founder of the c language. • It was developed to overcome the problems of previous languages such as B, BCPL, etc. • Initially, C language was developed to be used in UNIX operating system. It inherits many features of previous languages such as B and BCPL. • Let's see the programming languages that were developed before C language. Language Year Developed By Algol 1960 International Group BCPL 1967 Martin Richard B 1970 Ken Thompson Traditional C 1972 Dennis Ritchie K & R C 1978 Kernighan & Dennis Ritchie ANSI C 1989 ANSI Committee ANSI/ISO C 1990 ISO Committee C99 1999 Standardization Committee
  • 4. Features C is the widely used language. It provides many features that are given below. • Simple • Procedural programming language • structured programming language • Rich Library • Memory Management • Fast Speed • Pointers • Recursion
  • 5. Get started with C? • Get Started With C • To start using C, you need two things: • A text editor, like Notepad, to write C code • A compiler, like Turbo C++, Code Blocks, to translate the C code into a language that the computer will understand. • There are many text editors and compilers to choose from. Here, we will use an IDE (see below). • An IDE (Integrated Development Environment) is used to edit AND compile the code. • Note: Web-based IDE's can work as well, but functionality is limited. • We will use Turbo C++ which we believe is a good place to start. • You can find the latest version of Turbo C++ at https://developerinsider.co/download-turbo-c-for-windows-7-8-8-1-and- windows-10-32-64-bit-full-screen/ . Download setup.exe file, which will install the text editor with a compiler.
  • 6. Structure of C program
  • 7.
  • 8.
  • 9.
  • 10. Before writing program in C, we need to have a basic knowledge in the following. Character set. and Tokens
  • 11. 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 following different types of token are used in C 1) Identifiers 2)Keywords 3)Constants 4) Operators 5)Punctuation Symbols
  • 12. Tokens 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
  • 13. Identifiers • A 'C' program consist of two types of elements , user defined and system defined. Identifiers is nothing but a name given to these elements. • 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 character or label. • 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.
  • 14. 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 sensitive, 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
  • 15. 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.
  • 17.
  • 19.
  • 20. 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 Operators
  • 21. Arithmetic Operator Arithmetic Operators Arithmetic operators are used to perform common mathematical operations. Operator Name Description Example Try it + Addition Adds together two values x + y Try it » - Subtraction Subtracts one value from another x - y Try it » * Multiplication Multiplies two values x * y Try it » / Division Divides one value by another x / y Try it » % Modulus Returns the division remainder x % y Try it » ++ Increment Increases the value of a variable by 1 ++x Try it » -- Decrement Decreases the value of a variable by 1 --x
  • 22. Increment and Decrement Operator The decrement (–) and increment (++) operators are special types of operators used in programming languages to decrement and increment the value of the given variable by 1 (one), respectively. Types of Increment and Decrement Operators in C Following types of increment and decrement operators are found in the C language: Prefix Increment operator Prefix Decrement operator Postfix Increment operator Postfix Decrement operator Increment Operators We use increment operators in C to increment the given value of a variable by 1. For instance, int a = 1, b = 1; ++b; // valid ++3; // invalid – increment operator is operating on constant value ++(a+b); // invalid – increment operator is operating on expression
  • 23. 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
  • 24. 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
  • 25. 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