SlideShare a Scribd company logo
1 of 23
Download to read offline
PROGRAMMING IN C
Dr. Lothe Savita A.
To study…..
4th Dec. 2018Dr. Lothe Savita A.
2
 Introduction
 Basic Elements and operators
 Data types
 C program and I/O statements
Introduction
4th Dec. 2018Dr. Lothe Savita A.
3
 C is programming language developed at AT & T’s
Bell Laboratories ---USA – in 1972.
 Dennis Ritchie.
History
4th Dec. 2018Dr. Lothe Savita A.
4 Year Language Developed By Remarks
1960 ALGOL International
Committee
Too general, too
abstract
1963 CPL Cambridge
university
Hard to learn, difficult
to implement
1967 BCPL Martin Richards at
Cambridge
University
Could deal with a
specific problems
1970 B Ken Thompson at
AT & T
Could deal with a
specific problems
1972 C Dennis Ritchie at
AT & T
Lost generality of BCPL
and B restored.
Where C stands
4th Dec. 2018Dr. Lothe Savita A.
5
 Problem oriented Lang. / High level Lang.
Better programming efficiency i.e. faster program
development
 Machine oriented Lang. / Low level Lang.
better machine efficiency i.e. faster program
execution.
C stands in between these 2 categories.
Started with C
4th Dec. 2018Dr. Lothe Savita A.
6
 Learning English Lang.
 Steps in learning C
Alphabets Words Sentences paragraph
Instructions
Constants
Variables
Keywords
Alphabets
Digits
Special sym.
C Character Set
4th Dec. 2018Dr. Lothe Savita A.
7
 Alphabets : A, B, …………..Y,Z
 a,b,c, …………..y,z
 Digits : 0,1,…………………9
 Special symbols : ~ ` ! @ # $ % ^ …..……
Constants, Variables & keywords
4th Dec. 2018Dr. Lothe Savita A.
8
 A constant is a quantity that doesn't change.
 Stored at locations in the memory of the computer.
4th Dec. 2018Dr. Lothe Savita A.
9
C constant
Integer
Real
character
Primary Secondary
Array
Pointer
Structure
Union
Enum
Rules for constructing integer constants
4th Dec. 2018Dr. Lothe Savita A.
10
 An integer constant must have at least one digit.
 It must not have a decimal point.
 It could be either positive or negative.
 If no sign precedes an integer constant it is assumed
to be positive.
 No commas or blanks are allowed.
 Range is -32768 to +32767.
 Eg : 426
+782
Rules for constructing Real Constants
4th Dec. 2018Dr. Lothe Savita A.
11
 Called as floating point constants.
 Written into 2 forms:
 Fractional form
 Exponential form
Rules for constructing real constants in
fractional form:
4th Dec. 2018Dr. Lothe Savita A.
12
 A real constant must have atleast one digit.
 It must have a decimal point.
 It could be either positive or negative.
 Default sign is positive.
 No commas or blanks are allowed within a real
constant.
 Eg: +325.02
 -32.46
 -48.23
Rules for constructing real constants in
exponential form:
4th Dec. 2018Dr. Lothe Savita A.
13
• Represented in two parts:
• Part appearing before “e” called mantissa.
• Part following “e” is called as exponent.
• Rules:
• The mantissa part and the exponential part should be separated by
letter e.
• The mantissa may have a (+)or (-) sign.
• Default sign of mantissa part is (+)
• The exponent must have at least one digit which must be a (+)or (-)
integer. Default sign is (+)
• Range is -3.4e38 to 3.4e38
• Eg: +3.2e-5
• 4.1e8
Rules for constructing Character
Constants
4th Dec. 2018Dr. Lothe Savita A.
14
 A character constant is either a single alphabet, a
single digit or a single special symbol enclosed
within single inverted commas both the inverted
commas should point to the left.
 The maximum length of a character constant can be
1 character.
 Eg: ’A’
C Variables
4th Dec. 2018Dr. Lothe Savita A.
15
 A quantity which may vary during program
execution is called Variable.
 Variable are names given to locations in the
memory of computer where different constants are
stored.
4th Dec. 2018Dr. Lothe Savita A.
16
• A variable name is any combination of A to Z
alphabets, digits or underscores.
• First character in the variable name must be an
alphabet.
• No commas or blanks are allowed within a variable
name.
• No special symbol other than an underscore can be
used.
• Eg : si_int
• m_hra
• int si, m_hra;
C Keywords
4th Dec. 2018Dr. Lothe Savita A.
17
• Called as RESERVED WORDS.
• The keywords cannot be used as variable names.
AUTO DOUBLE IF STATIC
BREAK ELSE INT STRUCT
CASE ENUM LONG SWITCH
CHAR EXTERN NEAR TYPEDEF
CONST FLOAT REGISTER UNION
CONTINUE FAR RETURN UNSIGNED
DEFAULT FOR SHORT VOID
DO GOTO SIGNED WHILE
Function Main(1/4)2-18
Contains two parts
Part 1: Declarations
the part of a program that tells the compiler
the names of memory cells in a program
Part 2: Executable statements
program lines that are converted to machine
language instructions and executed by the
computer
4th Dec. 2018Dr. Lothe Savita A.
Function Main (2/4)2-19
 Syntax: int
main(void)
{
function body
}
4th Dec. 2018Dr. Lothe Savita A.
Function Main (3/4)2-20
 Examples: int
main(void)
{
printf(“Hello worldn”);
return(0);
}
4th Dec. 2018Dr. Lothe Savita A.
Function “Main”(4/4)2-21
 int
 indicates that the main function returns an integer value
(0) to the operating system when it finishes normal
execution
 (void)
 indicate that the main function receives no data from
the operating system
4th Dec. 2018Dr. Lothe Savita A.
First C program
4th Dec. 2018Dr. Lothe Savita A.
22
#include<stdio.h>
void main()
{
int p,n;
float r,si;
p=1000;
n=3;
r=8.5;
si=p*n*r/100;
printf(“%f”,si);
getch()
}
4th Dec. 2018Dr. Lothe Savita A.
23
Thank You

More Related Content

What's hot

Data members and member functions
Data members and member functionsData members and member functions
Data members and member functionsHarsh Patel
 
Object Oriented Programming Using C++
Object Oriented Programming Using C++Object Oriented Programming Using C++
Object Oriented Programming Using C++Muhammad Waqas
 
Micro Processor Lab Manual!
Micro Processor Lab Manual!Micro Processor Lab Manual!
Micro Processor Lab Manual!PRABHAHARAN429
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programmingAlpana Gupta
 
Keyboard interrupt
Keyboard interruptKeyboard interrupt
Keyboard interruptTech_MX
 
1327 Addressing Modes Of 8086
1327 Addressing Modes Of 80861327 Addressing Modes Of 8086
1327 Addressing Modes Of 8086techbed
 
Friends function and_classes
Friends function and_classesFriends function and_classes
Friends function and_classesasadsardar
 
Addressing Modes Of 8086
Addressing Modes Of 8086Addressing Modes Of 8086
Addressing Modes Of 8086Ikhlas Rahman
 
Lecture19 unionsin c.ppt
Lecture19 unionsin c.pptLecture19 unionsin c.ppt
Lecture19 unionsin c.ppteShikshak
 
Addressing modes
Addressing modesAddressing modes
Addressing modesAJAL A J
 
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 ProgrammingKamal Acharya
 
Complete C programming Language Course
Complete C programming Language CourseComplete C programming Language Course
Complete C programming Language CourseVivek chan
 
POINTERS IN C MRS.SOWMYA JYOTHI.pdf
POINTERS IN C MRS.SOWMYA JYOTHI.pdfPOINTERS IN C MRS.SOWMYA JYOTHI.pdf
POINTERS IN C MRS.SOWMYA JYOTHI.pdfSowmyaJyothi3
 
Programming the basic computer
Programming the basic computerProgramming the basic computer
Programming the basic computerKamal Acharya
 

What's hot (20)

Data members and member functions
Data members and member functionsData members and member functions
Data members and member functions
 
Object Oriented Programming Using C++
Object Oriented Programming Using C++Object Oriented Programming Using C++
Object Oriented Programming Using C++
 
Micro Processor Lab Manual!
Micro Processor Lab Manual!Micro Processor Lab Manual!
Micro Processor Lab Manual!
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
 
Introduction to c++ ppt 1
Introduction to c++ ppt 1Introduction to c++ ppt 1
Introduction to c++ ppt 1
 
ADDRESSING MODES
ADDRESSING MODESADDRESSING MODES
ADDRESSING MODES
 
Keyboard interrupt
Keyboard interruptKeyboard interrupt
Keyboard interrupt
 
1327 Addressing Modes Of 8086
1327 Addressing Modes Of 80861327 Addressing Modes Of 8086
1327 Addressing Modes Of 8086
 
Friends function and_classes
Friends function and_classesFriends function and_classes
Friends function and_classes
 
Addressing Modes Of 8086
Addressing Modes Of 8086Addressing Modes Of 8086
Addressing Modes Of 8086
 
Lecture19 unionsin c.ppt
Lecture19 unionsin c.pptLecture19 unionsin c.ppt
Lecture19 unionsin c.ppt
 
Addressing modes
Addressing modesAddressing modes
Addressing modes
 
C material
C materialC material
C material
 
Introduction to c programming
Introduction to c programmingIntroduction to c programming
Introduction to c programming
 
Python programming
Python  programmingPython  programming
Python programming
 
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
 
Complete C programming Language Course
Complete C programming Language CourseComplete C programming Language Course
Complete C programming Language Course
 
C vs c++
C vs c++C vs c++
C vs c++
 
POINTERS IN C MRS.SOWMYA JYOTHI.pdf
POINTERS IN C MRS.SOWMYA JYOTHI.pdfPOINTERS IN C MRS.SOWMYA JYOTHI.pdf
POINTERS IN C MRS.SOWMYA JYOTHI.pdf
 
Programming the basic computer
Programming the basic computerProgramming the basic computer
Programming the basic computer
 

Similar to Programming in C- Introduction

Similar to Programming in C- Introduction (20)

Variable declaration
Variable declarationVariable declaration
Variable declaration
 
Introduction to c
Introduction to cIntroduction to c
Introduction to c
 
Compiler design-lab-manual v-cse
Compiler design-lab-manual v-cseCompiler design-lab-manual v-cse
Compiler design-lab-manual v-cse
 
6276830.ppt
6276830.ppt6276830.ppt
6276830.ppt
 
PSPC--UNIT-2.pdf
PSPC--UNIT-2.pdfPSPC--UNIT-2.pdf
PSPC--UNIT-2.pdf
 
C programming language
C programming languageC programming language
C programming language
 
5 introduction-to-c
5 introduction-to-c5 introduction-to-c
5 introduction-to-c
 
C language Unit 2 Slides, UPTU C language
C language Unit 2 Slides, UPTU C languageC language Unit 2 Slides, UPTU C language
C language Unit 2 Slides, UPTU C language
 
C LANGUAGE NOTES
C LANGUAGE NOTESC LANGUAGE NOTES
C LANGUAGE NOTES
 
Introduction to C Programming
Introduction to C ProgrammingIntroduction to C Programming
Introduction to C Programming
 
Unit 4 Foc
Unit 4 FocUnit 4 Foc
Unit 4 Foc
 
Unit 2 c programming_basics
Unit 2 c programming_basicsUnit 2 c programming_basics
Unit 2 c programming_basics
 
CProgrammingTutorial
CProgrammingTutorialCProgrammingTutorial
CProgrammingTutorial
 
C_Programming_Language_tutorial__Autosaved_.pptx
C_Programming_Language_tutorial__Autosaved_.pptxC_Programming_Language_tutorial__Autosaved_.pptx
C_Programming_Language_tutorial__Autosaved_.pptx
 
Programming construction tools
Programming construction toolsProgramming construction tools
Programming construction tools
 
c programming session 1.pptx
c programming session 1.pptxc programming session 1.pptx
c programming session 1.pptx
 
C language
C language C language
C language
 
Chaptr 1
Chaptr 1Chaptr 1
Chaptr 1
 
C Sharp Nagina (1)
C Sharp Nagina (1)C Sharp Nagina (1)
C Sharp Nagina (1)
 
C Sharp Jn (1)
C Sharp Jn (1)C Sharp Jn (1)
C Sharp Jn (1)
 

More from savitamhaske

Specialized estimation tech
Specialized estimation techSpecialized estimation tech
Specialized estimation techsavitamhaske
 
8086 microprocessor
8086 microprocessor8086 microprocessor
8086 microprocessorsavitamhaske
 
Operators in c programming
Operators in c programmingOperators in c programming
Operators in c programmingsavitamhaske
 
Introduction to toc and compiler
Introduction to toc and compilerIntroduction to toc and compiler
Introduction to toc and compilersavitamhaske
 
Decision control and iterative statements
Decision control and iterative statementsDecision control and iterative statements
Decision control and iterative statementssavitamhaske
 

More from savitamhaske (8)

Introduction html
Introduction htmlIntroduction html
Introduction html
 
Specialized estimation tech
Specialized estimation techSpecialized estimation tech
Specialized estimation tech
 
8086 microprocessor
8086 microprocessor8086 microprocessor
8086 microprocessor
 
Tables
TablesTables
Tables
 
Operators in c programming
Operators in c programmingOperators in c programming
Operators in c programming
 
Introduction to toc and compiler
Introduction to toc and compilerIntroduction to toc and compiler
Introduction to toc and compiler
 
Function in c
Function in cFunction in c
Function in c
 
Decision control and iterative statements
Decision control and iterative statementsDecision control and iterative statements
Decision control and iterative statements
 

Recently uploaded

Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsMehedi Hasan Shohan
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningVitsRangannavar
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 

Recently uploaded (20)

Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software Solutions
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learning
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 

Programming in C- Introduction

  • 1. PROGRAMMING IN C Dr. Lothe Savita A.
  • 2. To study….. 4th Dec. 2018Dr. Lothe Savita A. 2  Introduction  Basic Elements and operators  Data types  C program and I/O statements
  • 3. Introduction 4th Dec. 2018Dr. Lothe Savita A. 3  C is programming language developed at AT & T’s Bell Laboratories ---USA – in 1972.  Dennis Ritchie.
  • 4. History 4th Dec. 2018Dr. Lothe Savita A. 4 Year Language Developed By Remarks 1960 ALGOL International Committee Too general, too abstract 1963 CPL Cambridge university Hard to learn, difficult to implement 1967 BCPL Martin Richards at Cambridge University Could deal with a specific problems 1970 B Ken Thompson at AT & T Could deal with a specific problems 1972 C Dennis Ritchie at AT & T Lost generality of BCPL and B restored.
  • 5. Where C stands 4th Dec. 2018Dr. Lothe Savita A. 5  Problem oriented Lang. / High level Lang. Better programming efficiency i.e. faster program development  Machine oriented Lang. / Low level Lang. better machine efficiency i.e. faster program execution. C stands in between these 2 categories.
  • 6. Started with C 4th Dec. 2018Dr. Lothe Savita A. 6  Learning English Lang.  Steps in learning C Alphabets Words Sentences paragraph Instructions Constants Variables Keywords Alphabets Digits Special sym.
  • 7. C Character Set 4th Dec. 2018Dr. Lothe Savita A. 7  Alphabets : A, B, …………..Y,Z  a,b,c, …………..y,z  Digits : 0,1,…………………9  Special symbols : ~ ` ! @ # $ % ^ …..……
  • 8. Constants, Variables & keywords 4th Dec. 2018Dr. Lothe Savita A. 8  A constant is a quantity that doesn't change.  Stored at locations in the memory of the computer.
  • 9. 4th Dec. 2018Dr. Lothe Savita A. 9 C constant Integer Real character Primary Secondary Array Pointer Structure Union Enum
  • 10. Rules for constructing integer constants 4th Dec. 2018Dr. Lothe Savita A. 10  An integer constant must have at least one digit.  It must not have a decimal point.  It could be either positive or negative.  If no sign precedes an integer constant it is assumed to be positive.  No commas or blanks are allowed.  Range is -32768 to +32767.  Eg : 426 +782
  • 11. Rules for constructing Real Constants 4th Dec. 2018Dr. Lothe Savita A. 11  Called as floating point constants.  Written into 2 forms:  Fractional form  Exponential form
  • 12. Rules for constructing real constants in fractional form: 4th Dec. 2018Dr. Lothe Savita A. 12  A real constant must have atleast one digit.  It must have a decimal point.  It could be either positive or negative.  Default sign is positive.  No commas or blanks are allowed within a real constant.  Eg: +325.02  -32.46  -48.23
  • 13. Rules for constructing real constants in exponential form: 4th Dec. 2018Dr. Lothe Savita A. 13 • Represented in two parts: • Part appearing before “e” called mantissa. • Part following “e” is called as exponent. • Rules: • The mantissa part and the exponential part should be separated by letter e. • The mantissa may have a (+)or (-) sign. • Default sign of mantissa part is (+) • The exponent must have at least one digit which must be a (+)or (-) integer. Default sign is (+) • Range is -3.4e38 to 3.4e38 • Eg: +3.2e-5 • 4.1e8
  • 14. Rules for constructing Character Constants 4th Dec. 2018Dr. Lothe Savita A. 14  A character constant is either a single alphabet, a single digit or a single special symbol enclosed within single inverted commas both the inverted commas should point to the left.  The maximum length of a character constant can be 1 character.  Eg: ’A’
  • 15. C Variables 4th Dec. 2018Dr. Lothe Savita A. 15  A quantity which may vary during program execution is called Variable.  Variable are names given to locations in the memory of computer where different constants are stored.
  • 16. 4th Dec. 2018Dr. Lothe Savita A. 16 • A variable name is any combination of A to Z alphabets, digits or underscores. • First character in the variable name must be an alphabet. • No commas or blanks are allowed within a variable name. • No special symbol other than an underscore can be used. • Eg : si_int • m_hra • int si, m_hra;
  • 17. C Keywords 4th Dec. 2018Dr. Lothe Savita A. 17 • Called as RESERVED WORDS. • The keywords cannot be used as variable names. AUTO DOUBLE IF STATIC BREAK ELSE INT STRUCT CASE ENUM LONG SWITCH CHAR EXTERN NEAR TYPEDEF CONST FLOAT REGISTER UNION CONTINUE FAR RETURN UNSIGNED DEFAULT FOR SHORT VOID DO GOTO SIGNED WHILE
  • 18. Function Main(1/4)2-18 Contains two parts Part 1: Declarations the part of a program that tells the compiler the names of memory cells in a program Part 2: Executable statements program lines that are converted to machine language instructions and executed by the computer 4th Dec. 2018Dr. Lothe Savita A.
  • 19. Function Main (2/4)2-19  Syntax: int main(void) { function body } 4th Dec. 2018Dr. Lothe Savita A.
  • 20. Function Main (3/4)2-20  Examples: int main(void) { printf(“Hello worldn”); return(0); } 4th Dec. 2018Dr. Lothe Savita A.
  • 21. Function “Main”(4/4)2-21  int  indicates that the main function returns an integer value (0) to the operating system when it finishes normal execution  (void)  indicate that the main function receives no data from the operating system 4th Dec. 2018Dr. Lothe Savita A.
  • 22. First C program 4th Dec. 2018Dr. Lothe Savita A. 22 #include<stdio.h> void main() { int p,n; float r,si; p=1000; n=3; r=8.5; si=p*n*r/100; printf(“%f”,si); getch() }
  • 23. 4th Dec. 2018Dr. Lothe Savita A. 23 Thank You