0% found this document useful (0 votes)
12 views

Introduction To C Programming

C

Uploaded by

Kalai Chelvan G
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Introduction To C Programming

C

Uploaded by

Kalai Chelvan G
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

Introduction to C Programming

Introduction to C Programming
▪ C was originally developed in the 1970s, by Dennis Ritchie at Bell Telephone
Laboratories, Inc.

▪ C is a High level , general –purpose structured programming language. Instructions of C


consists of terms that are very closely same to algebraic expressions, consisting of certain
English keywords such as if, else, for ,do and while

▪ C contains certain additional features that allows it to be used at a lower level , acting as
bridge between machine language and the high level languages.

▪ This allows C to be used for system programming as well as for applications


programming
History of C Programming

ALGOL ANSI ANSI/ISO


(1960) (1983) (1990)

BCPL C95
K & RC
(1967) (1995)

Traditional C99
B (1970)
C (1972) (1999)
Program

▪ A program consists of a series of instructions that a computer process


to perform the required operation.

▪ Set of software programs that describe the program are called


software.

▪ The process of software development is called programming and the


person who develops the computer program are called programmer.
Characteristics of Program

▪ Portability:- Portability refers to an application to run on a different


platform, which or without minimum changes.

▪ Readability:- The programmer should be written in with a more user-


friendly approach or in such a way that it makes other programmer
users follow the logic of the program without much effort.
Characteristics of Program
▪ Efficiency:- Live program at required certain processing time and memory
to process the instruction and data a program should be let out in such a
manner, that it utilized the least amount of memory and processing time.

▪ Flexibility:- A program is flexible enough to handle most of the changes


without having the rewrite the entire program, most of the program is
dependent on a certain period and their required modification from time to
time.
Characteristics of Program
▪ Generality:- if a program is developed for a particular task, then it should
also be used for all similar tasks of the same domain.

▪ Documentation:- Documentation is one of the most important


components of application development, even if a program is developed
following the best programming packages it will be rendered useless if the
and user is not able to fully utilize the functionality of the application level.
Structure of C Program

1. Documentation Section // Author : Alwyn Rajiv // Single Line Comment


// Date : 26/11/2021
/* Multiple Line Comment*/
/* Program for Addition to two
numbers */

2. Link Section – Pre- #include <stdio.h> printf, scanf

#include <conio.h> getch()


processor directive
#include <math.h> sqart

#include <string.h> strlen, strcmp


Structure of C Program

3. Definition This section defines pi = 3.14


#define pi 3.14
all the symbolic constant
#define MAX 100

4. Global Declarations int a;


– Global function float a;
Structure of C Program

5. Main Function void main () pi = 3.14

• Local declaration
int main() – return 0
• Statement – Executable part
4. Subprogram Section- void sum ()
user defined function
Structure of C Program
Pre-processor Directives Example
Global Declaration
#include <stdio.h>
main () int main ()
{
{
Local Declaration printf(“/n Welcome to the World of C:”);
Statements
return 0;
} }
Function 1()……N()
{ Output:
Local Declaration Welcome to the World of C:
Statements
}
How to Program

In order to design a program, a programmer must determine three basic


requirements:
▪ The instructions to be performed
▪ The order in which those instructions are to be performed
▪ The data required to perform those instructions.
Program - Example

Write a program to add two numbers:

▪ Input to numbers

▪ Add these two numbers

▪ Display the output

A, B C =A+ B C
Input Processing Output
Program – Example
(Add two Numbers)
#include<stdio.h>
Function Header C program basically consists of
#include<conio.h>
void main() Main Function the following parts −
{
int a,b,sum; Local Declaration ▪ Preprocessor Commands
clrscr();
printf(“Enter the Two Numbers: “); ▪ Functions
scanf(“%d%d”,&a,&b); Function Statement
Or
▪ Variables
sum=a+b;
Function Body
printf(“Sum=%d”,sum); ▪ Statements & Expressions
getch();
} ▪ Comments
Thank You

You might also like