SlideShare a Scribd company logo
Introduction to
C Programming
V.V.Subrahmanyam,
Sr. Lecturer,
SOCIS, IGNOU
Date: 04-02-07
Time: 12-00 to 12-45
The best way to escape the
problem is to solve it.
Alan
Saporta
Introduction
Knowledge in a programming language
is prerequisite to the study of most of
the computer science courses.
A programming language is the
principal interface with the computer.
Understanding the variety of
programming languages and the design
trade offs between the different
programming paradigms makes it much
easier to master new languages
quickly.
Algorithm: It is a series of steps
arranged in a logical sequence to solve
the problem.
Flowchart: It is a pictorial
representation of a sequence of
instructions using some predefined
symbols.
Algorithm and a Flowchart
Programming Language and
Program
Programming Language: In practice, it is
necessary to express an algorithm using
some programming language to instruct the
computer to solve the problem.
Program: A sequence of instructions written
in any programming language to solve the
problem using a computer.
Categories of Programming
Languages
Low level languages or Machine
oriented languages:
Whose design is governed by the circuitry
and the structure of the machine.
Difficult to learn
These are designed to give a better machine
efficiency i.e., faster program execution.
Machine dependent.
Examples: Machine language, Assembly
language
High level languages or Problem
Oriented languages
These are oriented towards describing
the procedures for solving the problem.
Machine Independent
Easy to learn
Machine directly cannot understand
them.
Examples: FORTRAN, PASCAL, C etc.
C Programming Language
Developed at AT & T Bell Laboratory in
1970’s.
Designed by Dennis Ritchie.
Salient features of C
General Purpose, structured
programming language.
It can considered as a High level
language, however as it combines both
the features, it can be treated as a
Middle level language.
Portable
Easy to debug
Easy to test and maintain
Structure of a C Program
Preprocessor directives
Global data declarations
main()
{
Declaration part;
----
Program Statements;
--
---
---
}
User defined functions
A Simple C Program
/* Program to print a message*/
#include <stdio.h>
main()
{
printf(“I am in the first semester of MCAn”);
}
Program to add to numbers
/* Program to add to numbers*/
#include <stdio.h>
main()
{
int a, b , sum;
printf (“ Enter the values of a and b:n”);
scanf(“%d, %d”, &a, &b);
sum = a+b;
printf(“the sum is %d”, sum);
}
C Character Set
Uppercase Letters: A to Z
Lowercase Letters: a to z
Digits: 0 to 9
Certain Special characters as building
blocks to form basic program elements
(e.g. constants, variables, operators,
expressions etc..)
Special symbols: %, &, +, _ , - # etc.
Identifiers
Identifiers are the names that are given
to the various program elements, such
as variables, functions and arrays.
Identifiers consist of letters and digits, in
any order, except the first character
must be a letter.
Both upper case and lower case are
allowed.
Contd..
No special symbols, except the
underscore(_) is allowed.
An identifier can also begin with an
underscore(_).
Examples: x, y12, sum_1, amount, _temp
etc..
Keywords
Reserved words that have standard,
predefined meaning in C language.
These are used for intended purpose
only, these cannot be used as
programmer-defined identifiers.
Examples: auto, break, case, switch, for,
goto, struct etc..
Basic Data types
Data type Description Typical Memory
Requirements
Int Integer 2 bytes or one
word
Char A character 1 byte
Float Decimal
number
4 bytes
Double Double
precision
8 bytes
Constants
Interger Constants
Floating-point constants
Character Constants
String Constants
Variables
It is an identifier that is used to
represent some specified type of
information within a designated portion
of a program.
Is used to represent a single data item
(a numerical quantity or a character
constant).
The data item must be assigned to the
variable at some point of the program
and later it can be referenced with the
name.
Declarations
A declaration associates a group of
variables with a specific data type..
In C, all the variables must be declared
before they can appear in executable
statements.
Examples: int a;
int a, b, c;
char flag;
Symbolic Constants
It is the name that substitutes for a
sequence of characters.
The characters may represent a
numeric constant, a character constant
and a string constant.
Examples: #define RATE 0.23
#define PI 3.1415
#define TRUE 1
STATEMENTS
A statement causes the computer to
carry out some action.
 Expression statement
 Compound statement
 Control statement
Arithmetic Operators
Operator Purpose
+ Addition
- Subtraction
* Multiplication
/ Division
% Remainder after
the division
Relational Operators
Operator Meaning
< Less than
<= Less than or equal to
> Greater than
>= Greater than or
equal to
== Equal to
!= Not equal to
Logical Operators
Operator Meaning
&& And
|| Or
Assignment Operator
Identifier = expression
Examples: a = 3;
x=y;
area = Length * breadth
Conditional Operator
expr1 ? Expr 2 : expr 3
Example: (i<0) ? 0: 100;
j= (f<g) ? f: g;
Ad

Recommended

PPT
Chapter3
Kamran
 
PPTX
Character set of c
Chandrapriya Rediex
 
PPTX
Recursive Function
Kamal Acharya
 
PPTX
Programming flowcharts for C Language
Aryan Ajmer
 
PPS
Registers and-common-bus
Anuj Modi
 
PPSX
Programming in c
vineet4523
 
PPTX
Expression and Operartor In C Programming
Kamal Acharya
 
PPT
Branching in C
Prabhu Govind
 
PPT
Constants in C Programming
programming9
 
PPTX
System Programming Overview
Dattatray Gandhmal
 
PPT
Introduction to c#
OpenSource Technologies Pvt. Ltd.
 
PPT
C presentation book
krunal1210
 
PPTX
Presentation on C programming language
Ashmita Tuition Center
 
PPTX
Input output statement in C
Muthuganesh S
 
PPTX
Code generation
Aparna Nayak
 
PPTX
Thread model of java
myrajendra
 
PPTX
History of java'
deepthisujithra
 
PPTX
Operator in c programming
Manoj Tyagi
 
PPT
Constructor
poonamchopra7975
 
PPTX
Data types in C language
kashyap399
 
PPTX
Symbol Table
Akhil Kaushik
 
PPT
Introduction to C Programming
MOHAMAD NOH AHMAD
 
PPT
COMPUTER PROGRAMMING
Yanne Evangelista
 
PPTX
Type checking compiler construction Chapter #6
Daniyal Mughal
 
PPTX
Function C programming
Appili Vamsi Krishna
 
PPTX
Introduction to C++
Sikder Tahsin Al-Amin
 
PPT
Computer architecture register transfer languages rtl
Mazin Alwaaly
 
PPTX
Important features of java
AL- AMIN
 
DOC
1. introduction to computer
Shankar Gangaju
 
PPTX
c programming session 1.pptx
RSathyaPriyaCSEKIOT
 

More Related Content

What's hot (20)

PPT
Constants in C Programming
programming9
 
PPTX
System Programming Overview
Dattatray Gandhmal
 
PPT
Introduction to c#
OpenSource Technologies Pvt. Ltd.
 
PPT
C presentation book
krunal1210
 
PPTX
Presentation on C programming language
Ashmita Tuition Center
 
PPTX
Input output statement in C
Muthuganesh S
 
PPTX
Code generation
Aparna Nayak
 
PPTX
Thread model of java
myrajendra
 
PPTX
History of java'
deepthisujithra
 
PPTX
Operator in c programming
Manoj Tyagi
 
PPT
Constructor
poonamchopra7975
 
PPTX
Data types in C language
kashyap399
 
PPTX
Symbol Table
Akhil Kaushik
 
PPT
Introduction to C Programming
MOHAMAD NOH AHMAD
 
PPT
COMPUTER PROGRAMMING
Yanne Evangelista
 
PPTX
Type checking compiler construction Chapter #6
Daniyal Mughal
 
PPTX
Function C programming
Appili Vamsi Krishna
 
PPTX
Introduction to C++
Sikder Tahsin Al-Amin
 
PPT
Computer architecture register transfer languages rtl
Mazin Alwaaly
 
PPTX
Important features of java
AL- AMIN
 
Constants in C Programming
programming9
 
System Programming Overview
Dattatray Gandhmal
 
C presentation book
krunal1210
 
Presentation on C programming language
Ashmita Tuition Center
 
Input output statement in C
Muthuganesh S
 
Code generation
Aparna Nayak
 
Thread model of java
myrajendra
 
History of java'
deepthisujithra
 
Operator in c programming
Manoj Tyagi
 
Constructor
poonamchopra7975
 
Data types in C language
kashyap399
 
Symbol Table
Akhil Kaushik
 
Introduction to C Programming
MOHAMAD NOH AHMAD
 
COMPUTER PROGRAMMING
Yanne Evangelista
 
Type checking compiler construction Chapter #6
Daniyal Mughal
 
Function C programming
Appili Vamsi Krishna
 
Introduction to C++
Sikder Tahsin Al-Amin
 
Computer architecture register transfer languages rtl
Mazin Alwaaly
 
Important features of java
AL- AMIN
 

Similar to Introduction to C Programming - I (20)

DOC
1. introduction to computer
Shankar Gangaju
 
PPTX
c programming session 1.pptx
RSathyaPriyaCSEKIOT
 
PDF
CP c++ programing project Unit 1 intro.pdf
ShivamYadav886008
 
PDF
Introduction to C programming
Kathmandu University
 
PPTX
CSE 1201: Structured Programming Language
Zubayer Farazi
 
PPT
1. overview of c
amar kakde
 
PDF
C programme presentation
DharmaKumariBhandari
 
PPT
SPC Unit 2
SIMONTHOMAS S
 
PDF
C programming language tutorial for beginers.pdf
ComedyTechnology
 
PPT
Lecture 01 2017
Jesmin Akhter
 
PDF
The New Yorker cartoon premium membership of the
shubhamgupta7133
 
DOCX
C and DS -unit 1 -Artificial Intelligence and ML.docx
msurfudeen6681
 
PPT
IT22101 Programming for Problem Solvingunit-2.ppt
kavitham66441
 
PPTX
unit2.pptx
sscprep9
 
PPT
Introduction to C
Janani Satheshkumar
 
PDF
Basic Information About C language PDF
Suraj Das
 
PPTX
Unit ii
sathisaran
 
PPTX
Aniket tore
anikettore1
 
PPTX
Msc prev completed
mshoaib15
 
PDF
Fundamental of Programming Language UNIT-I
TruptiWable1
 
1. introduction to computer
Shankar Gangaju
 
c programming session 1.pptx
RSathyaPriyaCSEKIOT
 
CP c++ programing project Unit 1 intro.pdf
ShivamYadav886008
 
Introduction to C programming
Kathmandu University
 
CSE 1201: Structured Programming Language
Zubayer Farazi
 
1. overview of c
amar kakde
 
C programme presentation
DharmaKumariBhandari
 
SPC Unit 2
SIMONTHOMAS S
 
C programming language tutorial for beginers.pdf
ComedyTechnology
 
Lecture 01 2017
Jesmin Akhter
 
The New Yorker cartoon premium membership of the
shubhamgupta7133
 
C and DS -unit 1 -Artificial Intelligence and ML.docx
msurfudeen6681
 
IT22101 Programming for Problem Solvingunit-2.ppt
kavitham66441
 
unit2.pptx
sscprep9
 
Introduction to C
Janani Satheshkumar
 
Basic Information About C language PDF
Suraj Das
 
Unit ii
sathisaran
 
Aniket tore
anikettore1
 
Msc prev completed
mshoaib15
 
Fundamental of Programming Language UNIT-I
TruptiWable1
 
Ad

More from vampugani (19)

PPTX
Social media presentation
vampugani
 
PPTX
Creating Quick Response(QR) Codes for the OER
vampugani
 
PPTX
Arithmetic Computation using 2's Complement Notation
vampugani
 
PPTX
Post Graduate Diploma in Computer Applications (PGDCA)
vampugani
 
PPTX
Overview of Distributed Systems
vampugani
 
PPT
Protection and Security in Operating Systems
vampugani
 
PPT
Virtual Memory
vampugani
 
PPT
Memory Management in OS
vampugani
 
PPT
Process Scheduling
vampugani
 
PPT
Processes
vampugani
 
PPT
Introduction to OS
vampugani
 
PPT
Operating Systems
vampugani
 
PPT
Distributed Systems
vampugani
 
PPT
Multiprocessor Systems
vampugani
 
PPT
File Management in Operating Systems
vampugani
 
PPT
Strings in c
vampugani
 
PPT
Arrays in c
vampugani
 
PPT
Control statements and functions in c
vampugani
 
PPT
Introduction to C Programming
vampugani
 
Social media presentation
vampugani
 
Creating Quick Response(QR) Codes for the OER
vampugani
 
Arithmetic Computation using 2's Complement Notation
vampugani
 
Post Graduate Diploma in Computer Applications (PGDCA)
vampugani
 
Overview of Distributed Systems
vampugani
 
Protection and Security in Operating Systems
vampugani
 
Virtual Memory
vampugani
 
Memory Management in OS
vampugani
 
Process Scheduling
vampugani
 
Processes
vampugani
 
Introduction to OS
vampugani
 
Operating Systems
vampugani
 
Distributed Systems
vampugani
 
Multiprocessor Systems
vampugani
 
File Management in Operating Systems
vampugani
 
Strings in c
vampugani
 
Arrays in c
vampugani
 
Control statements and functions in c
vampugani
 
Introduction to C Programming
vampugani
 
Ad

Recently uploaded (20)

PPTX
SCHIZOPHRENIA OTHER PSYCHOTIC DISORDER LIKE Persistent delusion/Capgras syndr...
parmarjuli1412
 
PPTX
GREAT QUIZ EXCHANGE 2025 - GENERAL QUIZ.pptx
Ronisha Das
 
PDF
Public Health For The 21st Century 1st Edition Judy Orme Jane Powell
trjnesjnqg7801
 
PPTX
CRYPTO TRADING COURSE BY FINANCEWORLD.IO
AndrewBorisenko3
 
PDF
VCE Literature Section A Exam Response Guide
jpinnuck
 
PDF
University of Ghana Cracks Down on Misconduct: Over 100 Students Sanctioned
Kweku Zurek
 
PDF
Learning Styles Inventory for Senior High School Students
Thelma Villaflores
 
PDF
K12 Tableau User Group virtual event June 18, 2025
dogden2
 
PDF
ECONOMICS, DISASTER MANAGEMENT, ROAD SAFETY - STUDY MATERIAL [10TH]
SHERAZ AHMAD LONE
 
PPTX
Q1_TLE 8_Week 1- Day 1 tools and equipment
clairenotado3
 
PDF
English 3 Quarter 1_LEwithLAS_Week 1.pdf
DeAsisAlyanajaneH
 
PPTX
Code Profiling in Odoo 18 - Odoo 18 Slides
Celine George
 
PPTX
LAZY SUNDAY QUIZ "A GENERAL QUIZ" JUNE 2025 SMC QUIZ CLUB, SILCHAR MEDICAL CO...
Ultimatewinner0342
 
PPT
M&A5 Q1 1 differentiate evolving early Philippine conventional and contempora...
ErlizaRosete
 
PPTX
How to Customize Quotation Layouts in Odoo 18
Celine George
 
PDF
LDMMIA Shop & Student News Summer Solstice 25
LDM & Mia eStudios
 
PPTX
How payment terms are configured in Odoo 18
Celine George
 
PDF
This is why students from these 44 institutions have not received National Se...
Kweku Zurek
 
PDF
Aprendendo Arquitetura Framework Salesforce - Dia 02
Mauricio Alexandre Silva
 
PPTX
How to Manage Different Customer Addresses in Odoo 18 Accounting
Celine George
 
SCHIZOPHRENIA OTHER PSYCHOTIC DISORDER LIKE Persistent delusion/Capgras syndr...
parmarjuli1412
 
GREAT QUIZ EXCHANGE 2025 - GENERAL QUIZ.pptx
Ronisha Das
 
Public Health For The 21st Century 1st Edition Judy Orme Jane Powell
trjnesjnqg7801
 
CRYPTO TRADING COURSE BY FINANCEWORLD.IO
AndrewBorisenko3
 
VCE Literature Section A Exam Response Guide
jpinnuck
 
University of Ghana Cracks Down on Misconduct: Over 100 Students Sanctioned
Kweku Zurek
 
Learning Styles Inventory for Senior High School Students
Thelma Villaflores
 
K12 Tableau User Group virtual event June 18, 2025
dogden2
 
ECONOMICS, DISASTER MANAGEMENT, ROAD SAFETY - STUDY MATERIAL [10TH]
SHERAZ AHMAD LONE
 
Q1_TLE 8_Week 1- Day 1 tools and equipment
clairenotado3
 
English 3 Quarter 1_LEwithLAS_Week 1.pdf
DeAsisAlyanajaneH
 
Code Profiling in Odoo 18 - Odoo 18 Slides
Celine George
 
LAZY SUNDAY QUIZ "A GENERAL QUIZ" JUNE 2025 SMC QUIZ CLUB, SILCHAR MEDICAL CO...
Ultimatewinner0342
 
M&A5 Q1 1 differentiate evolving early Philippine conventional and contempora...
ErlizaRosete
 
How to Customize Quotation Layouts in Odoo 18
Celine George
 
LDMMIA Shop & Student News Summer Solstice 25
LDM & Mia eStudios
 
How payment terms are configured in Odoo 18
Celine George
 
This is why students from these 44 institutions have not received National Se...
Kweku Zurek
 
Aprendendo Arquitetura Framework Salesforce - Dia 02
Mauricio Alexandre Silva
 
How to Manage Different Customer Addresses in Odoo 18 Accounting
Celine George
 

Introduction to C Programming - I

  • 1. Introduction to C Programming V.V.Subrahmanyam, Sr. Lecturer, SOCIS, IGNOU Date: 04-02-07 Time: 12-00 to 12-45
  • 2. The best way to escape the problem is to solve it. Alan Saporta
  • 3. Introduction Knowledge in a programming language is prerequisite to the study of most of the computer science courses. A programming language is the principal interface with the computer. Understanding the variety of programming languages and the design trade offs between the different programming paradigms makes it much easier to master new languages quickly.
  • 4. Algorithm: It is a series of steps arranged in a logical sequence to solve the problem. Flowchart: It is a pictorial representation of a sequence of instructions using some predefined symbols. Algorithm and a Flowchart
  • 5. Programming Language and Program Programming Language: In practice, it is necessary to express an algorithm using some programming language to instruct the computer to solve the problem. Program: A sequence of instructions written in any programming language to solve the problem using a computer.
  • 6. Categories of Programming Languages Low level languages or Machine oriented languages: Whose design is governed by the circuitry and the structure of the machine. Difficult to learn These are designed to give a better machine efficiency i.e., faster program execution. Machine dependent. Examples: Machine language, Assembly language
  • 7. High level languages or Problem Oriented languages These are oriented towards describing the procedures for solving the problem. Machine Independent Easy to learn Machine directly cannot understand them. Examples: FORTRAN, PASCAL, C etc.
  • 8. C Programming Language Developed at AT & T Bell Laboratory in 1970’s. Designed by Dennis Ritchie.
  • 9. Salient features of C General Purpose, structured programming language. It can considered as a High level language, however as it combines both the features, it can be treated as a Middle level language. Portable Easy to debug Easy to test and maintain
  • 10. Structure of a C Program Preprocessor directives Global data declarations main() { Declaration part; ---- Program Statements; -- --- --- } User defined functions
  • 11. A Simple C Program /* Program to print a message*/ #include <stdio.h> main() { printf(“I am in the first semester of MCAn”); }
  • 12. Program to add to numbers /* Program to add to numbers*/ #include <stdio.h> main() { int a, b , sum; printf (“ Enter the values of a and b:n”); scanf(“%d, %d”, &a, &b); sum = a+b; printf(“the sum is %d”, sum); }
  • 13. C Character Set Uppercase Letters: A to Z Lowercase Letters: a to z Digits: 0 to 9 Certain Special characters as building blocks to form basic program elements (e.g. constants, variables, operators, expressions etc..) Special symbols: %, &, +, _ , - # etc.
  • 14. Identifiers Identifiers are the names that are given to the various program elements, such as variables, functions and arrays. Identifiers consist of letters and digits, in any order, except the first character must be a letter. Both upper case and lower case are allowed.
  • 15. Contd.. No special symbols, except the underscore(_) is allowed. An identifier can also begin with an underscore(_). Examples: x, y12, sum_1, amount, _temp etc..
  • 16. Keywords Reserved words that have standard, predefined meaning in C language. These are used for intended purpose only, these cannot be used as programmer-defined identifiers. Examples: auto, break, case, switch, for, goto, struct etc..
  • 17. Basic Data types Data type Description Typical Memory Requirements Int Integer 2 bytes or one word Char A character 1 byte Float Decimal number 4 bytes Double Double precision 8 bytes
  • 19. Variables It is an identifier that is used to represent some specified type of information within a designated portion of a program. Is used to represent a single data item (a numerical quantity or a character constant). The data item must be assigned to the variable at some point of the program and later it can be referenced with the name.
  • 20. Declarations A declaration associates a group of variables with a specific data type.. In C, all the variables must be declared before they can appear in executable statements. Examples: int a; int a, b, c; char flag;
  • 21. Symbolic Constants It is the name that substitutes for a sequence of characters. The characters may represent a numeric constant, a character constant and a string constant. Examples: #define RATE 0.23 #define PI 3.1415 #define TRUE 1
  • 22. STATEMENTS A statement causes the computer to carry out some action.  Expression statement  Compound statement  Control statement
  • 23. Arithmetic Operators Operator Purpose + Addition - Subtraction * Multiplication / Division % Remainder after the division
  • 24. Relational Operators Operator Meaning < Less than <= Less than or equal to > Greater than >= Greater than or equal to == Equal to != Not equal to
  • 26. Assignment Operator Identifier = expression Examples: a = 3; x=y; area = Length * breadth
  • 27. Conditional Operator expr1 ? Expr 2 : expr 3 Example: (i<0) ? 0: 100; j= (f<g) ? f: g;