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

PPTX
Python-DataAbstarction.pptx
Karudaiyar Ganapathy
 
PPS
Registers and-common-bus
Anuj Modi
 
PPTX
Variables in java.pptx
gomathikalai
 
PPT
The structure of process
Abhaysinh Surve
 
PDF
Prototype model (software engineering)
MuhammadTalha436
 
PPTX
Traversals | Data Structures
Omair Imtiaz Ansari
 
PPTX
System calls
Bernard Senam
 
PPTX
Features of java
WILLFREDJOSE W
 
PPTX
Phases of compiler
Karan Deopura
 
PPT
Super and final in java
anshu_atri
 
PPT
9. Input Output in java
Nilesh Dalvi
 
PDF
Exception Handling in Java
Java2Blog
 
PPTX
Garbage collection
Somya Bagai
 
DOCX
Java questions for viva
Vipul Naik
 
PPTX
Operating system 32 logical versus physical address
Vaibhav Khanna
 
PDF
Difference among 8085,8086,80186,80286,80386 Microprocessor.pdf
Mahbubay Rabbani Mim
 
PPS
Interface
kamal kotecha
 
PPT
Programming languages
gaurav jain
 
PPT
80486 microprocessor
Mihika Shah
 
PPTX
C# Inheritance
Prem Kumar Badri
 
Python-DataAbstarction.pptx
Karudaiyar Ganapathy
 
Registers and-common-bus
Anuj Modi
 
Variables in java.pptx
gomathikalai
 
The structure of process
Abhaysinh Surve
 
Prototype model (software engineering)
MuhammadTalha436
 
Traversals | Data Structures
Omair Imtiaz Ansari
 
System calls
Bernard Senam
 
Features of java
WILLFREDJOSE W
 
Phases of compiler
Karan Deopura
 
Super and final in java
anshu_atri
 
9. Input Output in java
Nilesh Dalvi
 
Exception Handling in Java
Java2Blog
 
Garbage collection
Somya Bagai
 
Java questions for viva
Vipul Naik
 
Operating system 32 logical versus physical address
Vaibhav Khanna
 
Difference among 8085,8086,80186,80286,80386 Microprocessor.pdf
Mahbubay Rabbani Mim
 
Interface
kamal kotecha
 
Programming languages
gaurav jain
 
80486 microprocessor
Mihika Shah
 
C# Inheritance
Prem Kumar Badri
 

Similar to Programming in C- Introduction (20)

PDF
Introduction to Computer and Programming - Lecture 03
hassaanciit
 
PDF
[ITP - Lecture 04] Variables and Constants in C/C++
Muhammad Hammad Waseem
 
PDF
Basic of the C language
Sachin Verma
 
PPT
6276830.ppt
Shrinivas54
 
DOCX
C basics by haseeb khan
Haseeb Shalmani
 
PPTX
programming for problem solving in C and C++.pptx
BamaSivasubramanianP
 
PDF
Introduction of c_language
SINGH PROJECTS
 
PDF
Introduction
Komal Pardeshi
 
PPTX
Data Types and Variables In C Programming
Kamal Acharya
 
PPTX
unit 1 cpds.pptx
madhurij54
 
PPTX
dinoC_ppt.pptx
DinobandhuThokdarCST
 
PPTX
Introduction to C language programming.pptx
OVIDMAMAH
 
PDF
Chapter 21 c language
Hareem Aslam
 
PPT
U2.ppt
thenmozhip8
 
PPSX
Programming in c
vineet4523
 
PPTX
C
PRADEEPA R
 
PPTX
C Programming Lecture 3 - Elements of C.pptx
Murali M
 
PDF
Lecture 4 constants_variables
eShikshak
 
PPTX
Introduction to C Programming
Aniket Patne
 
Introduction to Computer and Programming - Lecture 03
hassaanciit
 
[ITP - Lecture 04] Variables and Constants in C/C++
Muhammad Hammad Waseem
 
Basic of the C language
Sachin Verma
 
6276830.ppt
Shrinivas54
 
C basics by haseeb khan
Haseeb Shalmani
 
programming for problem solving in C and C++.pptx
BamaSivasubramanianP
 
Introduction of c_language
SINGH PROJECTS
 
Introduction
Komal Pardeshi
 
Data Types and Variables In C Programming
Kamal Acharya
 
unit 1 cpds.pptx
madhurij54
 
dinoC_ppt.pptx
DinobandhuThokdarCST
 
Introduction to C language programming.pptx
OVIDMAMAH
 
Chapter 21 c language
Hareem Aslam
 
U2.ppt
thenmozhip8
 
Programming in c
vineet4523
 
C Programming Lecture 3 - Elements of C.pptx
Murali M
 
Lecture 4 constants_variables
eShikshak
 
Introduction to C Programming
Aniket Patne
 
Ad

More from savitamhaske (8)

PPTX
Introduction html
savitamhaske
 
PPTX
Specialized estimation tech
savitamhaske
 
PDF
8086 microprocessor
savitamhaske
 
PPTX
Tables
savitamhaske
 
PDF
Operators in c programming
savitamhaske
 
PDF
Introduction to toc and compiler
savitamhaske
 
PPSX
Function in c
savitamhaske
 
PDF
Decision control and iterative statements
savitamhaske
 
Introduction html
savitamhaske
 
Specialized estimation tech
savitamhaske
 
8086 microprocessor
savitamhaske
 
Tables
savitamhaske
 
Operators in c programming
savitamhaske
 
Introduction to toc and compiler
savitamhaske
 
Function in c
savitamhaske
 
Decision control and iterative statements
savitamhaske
 
Ad

Recently uploaded (20)

PPTX
Feb 2021 Cohesity first pitch presentation.pptx
enginsayin1
 
PDF
Beyond Binaries: Understanding Diversity and Allyship in a Global Workplace -...
Imma Valls Bernaus
 
PDF
Revenue streams of the Wazirx clone script.pdf
aaronjeffray
 
PPTX
How Apagen Empowered an EPC Company with Engineering ERP Software
SatishKumar2651
 
PDF
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
PDF
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
PPTX
Fundamentals_of_Microservices_Architecture.pptx
MuhammadUzair504018
 
PPTX
3uTools Full Crack Free Version Download [Latest] 2025
muhammadgurbazkhan
 
PPTX
Perfecting XM Cloud for Multisite Setup.pptx
Ahmed Okour
 
PPTX
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 
PPTX
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
 
PPT
MergeSortfbsjbjsfk sdfik k
RafishaikIT02044
 
PPTX
Java Native Memory Leaks: The Hidden Villain Behind JVM Performance Issues
Tier1 app
 
PDF
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 
PPTX
Hardware(Central Processing Unit ) CU and ALU
RizwanaKalsoom2
 
PPTX
Migrating Millions of Users with Debezium, Apache Kafka, and an Acyclic Synch...
MD Sayem Ahmed
 
PDF
Thread In Android-Mastering Concurrency for Responsive Apps.pdf
Nabin Dhakal
 
PPTX
The Role of a PHP Development Company in Modern Web Development
SEO Company for School in Delhi NCR
 
PPTX
Platform for Enterprise Solution - Java EE5
abhishekoza1981
 
PPTX
Writing Better Code - Helping Developers make Decisions.pptx
Lorraine Steyn
 
Feb 2021 Cohesity first pitch presentation.pptx
enginsayin1
 
Beyond Binaries: Understanding Diversity and Allyship in a Global Workplace -...
Imma Valls Bernaus
 
Revenue streams of the Wazirx clone script.pdf
aaronjeffray
 
How Apagen Empowered an EPC Company with Engineering ERP Software
SatishKumar2651
 
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
Fundamentals_of_Microservices_Architecture.pptx
MuhammadUzair504018
 
3uTools Full Crack Free Version Download [Latest] 2025
muhammadgurbazkhan
 
Perfecting XM Cloud for Multisite Setup.pptx
Ahmed Okour
 
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
 
MergeSortfbsjbjsfk sdfik k
RafishaikIT02044
 
Java Native Memory Leaks: The Hidden Villain Behind JVM Performance Issues
Tier1 app
 
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 
Hardware(Central Processing Unit ) CU and ALU
RizwanaKalsoom2
 
Migrating Millions of Users with Debezium, Apache Kafka, and an Acyclic Synch...
MD Sayem Ahmed
 
Thread In Android-Mastering Concurrency for Responsive Apps.pdf
Nabin Dhakal
 
The Role of a PHP Development Company in Modern Web Development
SEO Company for School in Delhi NCR
 
Platform for Enterprise Solution - Java EE5
abhishekoza1981
 
Writing Better Code - Helping Developers make Decisions.pptx
Lorraine Steyn
 

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