SlideShare a Scribd company logo
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

More Related Content

Similar to Basics of C.ppt

Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
MEHALAS3
 
Basics of C (1).ppt
Basics of C (1).pptBasics of C (1).ppt
Basics of C (1).ppt
SteveIrwin25
 
Basics of C.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
kiran833055
 
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.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
kabhinavin
 
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
ChiranjeevivarmaP
 
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.ppt
Basics of C.pptBasics of C.ppt
Basics of C.ppt
SeethaDinesh
 
Basic of c language
Basic of c languageBasic of c language
Basic of c language
sunilchute1
 
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
ShivamYadav886008
 
#Code2 create c++ for beginners
#Code2 create  c++ for beginners #Code2 create  c++ for beginners
#Code2 create c++ for beginners
GDGKuwaitGoogleDevel
 
Introduction to C
Introduction to CIntroduction to C
Introduction to C
Janani Satheshkumar
 

Similar to Basics of C.ppt (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
 
Basics of C (1).ppt
Basics of C (1).pptBasics of C (1).ppt
Basics of C (1).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
 
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
 

More from 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.docx
8759000398
 
Testing in Software Engineering.docx
Testing in Software Engineering.docxTesting in Software Engineering.docx
Testing in Software Engineering.docx
8759000398
 
SAD_UnitII.docx
SAD_UnitII.docxSAD_UnitII.docx
SAD_UnitII.docx
8759000398
 
JavaScript Date Objects.docx
JavaScript Date Objects.docxJavaScript Date Objects.docx
JavaScript Date Objects.docx
8759000398
 
C Programming Strings.docx
C Programming Strings.docxC Programming Strings.docx
C Programming Strings.docx
8759000398
 
Nursing Infromatics.pptx
Nursing Infromatics.pptxNursing Infromatics.pptx
Nursing Infromatics.pptx
8759000398
 
newone2.pdf
newone2.pdfnewone2.pdf
newone2.pdf
8759000398
 
College app for android device
College app for android deviceCollege app for android device
College app for android device
8759000398
 
Android
AndroidAndroid
Android
8759000398
 

More from 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
 

Recently uploaded

GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
Nguyen Thanh Tu Collection
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
Excellence Foundation for South Sudan
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
PedroFerreira53928
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
Steve Thomason
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
Col Mukteshwar Prasad
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
PedroFerreira53928
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 

Recently uploaded (20)

GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
GIÁO ÁN DẠY THÊM (KẾ HOẠCH BÀI BUỔI 2) - TIẾNG ANH 8 GLOBAL SUCCESS (2 CỘT) N...
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
 
Introduction to Quality Improvement Essentials
Introduction to Quality Improvement EssentialsIntroduction to Quality Improvement Essentials
Introduction to Quality Improvement Essentials
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 

Basics of C.ppt

  • 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