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;

More Related Content

PPTX
PPTX
Input output statement in C
PPTX
Programming in C Presentation upto FILE
PPT
Recursion in c
PPTX
Introduction to programming
PPT
Input And Output
PPT
RECURSION IN C
PDF
MANAGING INPUT AND OUTPUT OPERATIONS IN C MRS.SOWMYA JYOTHI.pdf
Input output statement in C
Programming in C Presentation upto FILE
Recursion in c
Introduction to programming
Input And Output
RECURSION IN C
MANAGING INPUT AND OUTPUT OPERATIONS IN C MRS.SOWMYA JYOTHI.pdf

What's hot (20)

PPTX
Operators and expressions in c language
PPTX
introduction to c language
PPT
Introduction to C++
PPT
Tokens_C
PPT
Programming in c
PPTX
Logical and Conditional Operator In C language
PDF
Java lab-manual
PPTX
PPTX
Theory of programming
PPTX
User defined function in c
PPT
1. over view and history of c
PPTX
Steps for c program execution
PPTX
Function in c language(defination and declaration)
PPT
Basics of c++
PPTX
Functions in C
PDF
c_programming
PPT
Variables in C Programming
PPTX
Strings in C language
PPT
Introduction to c programming
PPTX
Intro to c++
Operators and expressions in c language
introduction to c language
Introduction to C++
Tokens_C
Programming in c
Logical and Conditional Operator In C language
Java lab-manual
Theory of programming
User defined function in c
1. over view and history of c
Steps for c program execution
Function in c language(defination and declaration)
Basics of c++
Functions in C
c_programming
Variables in C Programming
Strings in C language
Introduction to c programming
Intro to c++
Ad

Similar to Introduction to C Programming - I (20)

PPSX
C basics 4 std11(GujBoard)
PDF
Unit 2 introduction to c programming
PPTX
C Programming Unit-1
PPT
Chapter3
DOCX
C programming language Reference Note
PPTX
C programming presentation(final)
DOC
1. introduction to computer
PDF
C programming
PPT
Introduction to C Programming
PPT
Unit 4 Foc
PDF
C programming course material
PPTX
C Language ppt create by Anand & Sager.pptx
PPTX
Introduction to C Unit 1
ODP
C prog ppt
PPTX
Introduction%20C.pptx
PPTX
PPTX
C programming slide day 01 uploadd by md abdullah al shakil
PPTX
c programming session 1.pptx
PPTX
c_pro_introduction.pptx
PPTX
C lang7age programming powerpoint presentation
C basics 4 std11(GujBoard)
Unit 2 introduction to c programming
C Programming Unit-1
Chapter3
C programming language Reference Note
C programming presentation(final)
1. introduction to computer
C programming
Introduction to C Programming
Unit 4 Foc
C programming course material
C Language ppt create by Anand & Sager.pptx
Introduction to C Unit 1
C prog ppt
Introduction%20C.pptx
C programming slide day 01 uploadd by md abdullah al shakil
c programming session 1.pptx
c_pro_introduction.pptx
C lang7age programming powerpoint presentation
Ad

More from vampugani (19)

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

Recently uploaded (20)

PPTX
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PPTX
Cell Types and Its function , kingdom of life
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
Business Ethics Teaching Materials for college
PPTX
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
Anesthesia in Laparoscopic Surgery in India
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
master seminar digital applications in india
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
Classroom Observation Tools for Teachers
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
Complications of Minimal Access Surgery at WLH
PDF
Pre independence Education in Inndia.pdf
The Healthy Child – Unit II | Child Health Nursing I | B.Sc Nursing 5th Semester
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Abdominal Access Techniques with Prof. Dr. R K Mishra
Final Presentation General Medicine 03-08-2024.pptx
Module 4: Burden of Disease Tutorial Slides S2 2025
Cell Types and Its function , kingdom of life
VCE English Exam - Section C Student Revision Booklet
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Business Ethics Teaching Materials for college
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Anesthesia in Laparoscopic Surgery in India
human mycosis Human fungal infections are called human mycosis..pptx
Supply Chain Operations Speaking Notes -ICLT Program
master seminar digital applications in india
Microbial disease of the cardiovascular and lymphatic systems
Classroom Observation Tools for Teachers
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Complications of Minimal Access Surgery at WLH
Pre independence Education in Inndia.pdf

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;