SlideShare a Scribd company logo
1 of 20
C
Topic

o Language

program
o Compile & Run
program
o Structure of C
program
o
•
•

Language)

(Low-Level

(Machine
language)
(MiddleLevel Language)

(Assembly Language)
(High-Level
Language)
Pascal, Fortran, C,
JAVA, …
1.
(Machine Language)

•

2 (0/1)

o
o

Object Code
(Assembly Language)

•
2
o
o

(

)
6
•

Languages)
–

(High-Level
C, JAVA,

Interpreter

(Compiler)

• Compiler
(
Pascal, C, ...)
• Interpreter
Compile
•

•

Source code (file)
C
Machine code (Object file)

C
Compile & Run
C

•
main)
•

C

(
Edit
C
• Preprocessor Directive
(

• Main Function (
1

Void main()

2

{

3

statements;

5

•

)

Programming

#include<stdio.h>

2

void main()

3

{

4
5

End

}

1

n

/* main function */
/ Begin (
)

variable declaration;

4

)

printf("C Programmingn");
}

cursor

C

/* Preprocessor directive*/
C
•

4

C

1.
Statements)
2.
Statements)
3.
Statements)
4.
Statements)

•

(Input / Output
(Expression
(Conditioning

(Looping

int x, y
float
• printf (
stdio)

C
Memory

stdio
Preprocessor Directive
o
printf
main
•
printf(“control string”,
variable,…);
 control string
o
printf(“C
o variable
(
Programming”); )
%d
integer
decimal %f
Memory
o %format
%d, %f, %c, %s
real
o

variable

o

n (new line), …
floating point


Programming

C
Memory
variable
(X)

• scanf (
stdio.h)
•

…

Address
0
1
2 (&X)
3
4
…

scanf(“%format,…”,
&variable,…);
o %format
o &variable

%d, %f, %c,

%s (Address)
scanf(“%d”, &X);
variable
integer

%d

integer
decimal %f
real
floating point

X

&X


2

(X, Y)
(Sum)

Memory

start

X
Y

Input X,Y

#include<stdio.h>

SUM

void main()
{
int X, Y, SUM;

printf("Enter X:"); scanf("%d", &X);

SUM = X+Y

printf("Enter Y:"); scanf("%d", &Y);

Print SUM

SUM = X+Y;
printf("Sum = %dn", SUM);

end

}

printf
(Output)
o scanf
C
o

C

(Input)

50
100
150
% format
• %format
scanf, printf
(integer)
(real)

%format
int

%d

float

%f

#include<stdio.h>
void main()
{
int X, Y, sum;
printf("Enter X:"); scanf("%d",&X);

printf("Enter Y:"); scanf("%d",&Y);
sum = X+Y
printf("sum = %dn", sum);
}

Memory
X
Y
SUM
3

W

Area
L



(Area)
Width x Length (
#include<stdio.h>

x

Area =
)

start
Input W,L

void main()
Area = W*L

{
int W,L;
float Area;
printf("Enter width:");

scanf("%d", &W);
printf("Enter length:");
scanf("%d", &L);
Area = W*L;
printf("Area = %fn", Area);
}

Print Area
end

Enter width: 5
_
Enter length: 10
_
Area = 50.0
4

1

2

3

4

5

6

7

8

9

10

11

12

1



(
#include<stdio.h>

)

start
Input Feet
F

void main()
Inches = Feet*12

{
int F,Inches;

Print Inches

printf("Enter feet:");
scanf("%d", &W);

end

inches = F*12;
printf("=%d inchesn", Inches);
}

Memory

2
Enter feet: _
= 24 inches

Inches
getchar, gets
• scanf
“%format

o

•

 getchar()

ENTER

Character
 getch()

ENTER

Library “stdio”
Library “conio”
(Day),



(Year)
November, 2013
Month day, year (
1, 2013 )
#include<stdio.h>
void main()

1,

(Month),
Memory

November
Day
Year

Month

{

int Day, Year;

1

2013

N
o
v
e
m
b
e
r

char Month[20];//string
printf("Enter Day:");scanf("%d",&Day);
printf("Enter Month:");scanf("%s",&Month);
printf("Enter Year:");scanf("%d",&Year);

1
Enter Day: _

printf("Date is %s %d,%dn",Month, Day, Year);

Enter Month: November
_

fflush(stdin);getchar();

2013
Enter Year: _

}

Date is November 1, 2013

Keyboard

More Related Content

What's hot (6)

Programming Protocol-Independent Packet Processors
Programming Protocol-Independent Packet ProcessorsProgramming Protocol-Independent Packet Processors
Programming Protocol-Independent Packet Processors
 
Golang
GolangGolang
Golang
 
Golang 101
Golang 101Golang 101
Golang 101
 
R Intro
R IntroR Intro
R Intro
 
2016 NCTU P4 Workshop
2016 NCTU P4 Workshop2016 NCTU P4 Workshop
2016 NCTU P4 Workshop
 
Coding with golang
Coding with golangCoding with golang
Coding with golang
 

Viewers also liked

腾讯大讲堂25 企业级搜索托管平台介绍
腾讯大讲堂25 企业级搜索托管平台介绍腾讯大讲堂25 企业级搜索托管平台介绍
腾讯大讲堂25 企业级搜索托管平台介绍
George Ang
 
基于Eucalyptus的教育知识服务体系模型研究(1)
基于Eucalyptus的教育知识服务体系模型研究(1)基于Eucalyptus的教育知识服务体系模型研究(1)
基于Eucalyptus的教育知识服务体系模型研究(1)
liangxiao0315
 
基于云计算平台的移动Iptv系统设计及负载均衡技术研究
基于云计算平台的移动Iptv系统设计及负载均衡技术研究基于云计算平台的移动Iptv系统设计及负载均衡技术研究
基于云计算平台的移动Iptv系统设计及负载均衡技术研究
liangxiao0315
 
Zaridah lecture2
Zaridah lecture2Zaridah lecture2
Zaridah lecture2
Aziz Sahat
 
Pharmalinks Global Regulatory Partners
Pharmalinks Global Regulatory PartnersPharmalinks Global Regulatory Partners
Pharmalinks Global Regulatory Partners
temreez
 
构建私有云计算平台的Eucalyptus架构分析
构建私有云计算平台的Eucalyptus架构分析构建私有云计算平台的Eucalyptus架构分析
构建私有云计算平台的Eucalyptus架构分析
liangxiao0315
 

Viewers also liked (9)

腾讯大讲堂25 企业级搜索托管平台介绍
腾讯大讲堂25 企业级搜索托管平台介绍腾讯大讲堂25 企业级搜索托管平台介绍
腾讯大讲堂25 企业级搜索托管平台介绍
 
Hadoop开发者入门专刊
Hadoop开发者入门专刊Hadoop开发者入门专刊
Hadoop开发者入门专刊
 
Ds program-print
Ds program-printDs program-print
Ds program-print
 
基于Eucalyptus的教育知识服务体系模型研究(1)
基于Eucalyptus的教育知识服务体系模型研究(1)基于Eucalyptus的教育知识服务体系模型研究(1)
基于Eucalyptus的教育知识服务体系模型研究(1)
 
基于云计算平台的移动Iptv系统设计及负载均衡技术研究
基于云计算平台的移动Iptv系统设计及负载均衡技术研究基于云计算平台的移动Iptv系统设计及负载均衡技术研究
基于云计算平台的移动Iptv系统设计及负载均衡技术研究
 
Zaridah lecture2
Zaridah lecture2Zaridah lecture2
Zaridah lecture2
 
Function creation and function call in c copy
Function creation and function call in c   copyFunction creation and function call in c   copy
Function creation and function call in c copy
 
Pharmalinks Global Regulatory Partners
Pharmalinks Global Regulatory PartnersPharmalinks Global Regulatory Partners
Pharmalinks Global Regulatory Partners
 
构建私有云计算平台的Eucalyptus架构分析
构建私有云计算平台的Eucalyptus架构分析构建私有云计算平台的Eucalyptus架构分析
构建私有云计算平台的Eucalyptus架构分析
 

Similar to 2

cmp104 lec 8
cmp104 lec 8cmp104 lec 8
cmp104 lec 8
kapil078
 
1. over view and history of c
1. over view and history of c1. over view and history of c
1. over view and history of c
Harish Kumawat
 
โปรแกรมคอมพิวเตอร์
โปรแกรมคอมพิวเตอร์โปรแกรมคอมพิวเตอร์
โปรแกรมคอมพิวเตอร์
Raksita Youngdee
 
Unit1 principle of programming language
Unit1 principle of programming languageUnit1 principle of programming language
Unit1 principle of programming language
Vasavi College of Engg
 

Similar to 2 (20)

0100_Embeded_C_CompilationProcess.pdf
0100_Embeded_C_CompilationProcess.pdf0100_Embeded_C_CompilationProcess.pdf
0100_Embeded_C_CompilationProcess.pdf
 
C Language
C LanguageC Language
C Language
 
Computer Programming In C.pptx
Computer Programming In C.pptxComputer Programming In C.pptx
Computer Programming In C.pptx
 
Programing fundamentals with C++
Programing fundamentals with C++Programing fundamentals with C++
Programing fundamentals with C++
 
cmp104 lec 8
cmp104 lec 8cmp104 lec 8
cmp104 lec 8
 
C for Engineers
C for EngineersC for Engineers
C for Engineers
 
1. over view and history of c
1. over view and history of c1. over view and history of c
1. over view and history of c
 
Sachin kumar ppt on programming in c
Sachin kumar ppt on programming in cSachin kumar ppt on programming in c
Sachin kumar ppt on programming in c
 
Lecture 1 introduction to language processors
Lecture 1  introduction to language processorsLecture 1  introduction to language processors
Lecture 1 introduction to language processors
 
โปรแกรมคอมพิวเตอร์
โปรแกรมคอมพิวเตอร์โปรแกรมคอมพิวเตอร์
โปรแกรมคอมพิวเตอร์
 
Embedded firmware
Embedded firmwareEmbedded firmware
Embedded firmware
 
What is turbo c and how it works
What is turbo c and how it worksWhat is turbo c and how it works
What is turbo c and how it works
 
Chapter 1 Introduction to C .pptx
Chapter 1 Introduction to C .pptxChapter 1 Introduction to C .pptx
Chapter 1 Introduction to C .pptx
 
Unit1 principle of programming language
Unit1 principle of programming languageUnit1 principle of programming language
Unit1 principle of programming language
 
Introduction of c programming unit-ii ppt
Introduction of  c programming unit-ii pptIntroduction of  c programming unit-ii ppt
Introduction of c programming unit-ii ppt
 
C language unit-1
C language unit-1C language unit-1
C language unit-1
 
C LANGUAGE UNIT-1 PREPARED BY M V BRAHMANANDA REDDY
C LANGUAGE UNIT-1 PREPARED BY M V BRAHMANANDA REDDYC LANGUAGE UNIT-1 PREPARED BY M V BRAHMANANDA REDDY
C LANGUAGE UNIT-1 PREPARED BY M V BRAHMANANDA REDDY
 
C languaGE UNIT-1
C languaGE UNIT-1C languaGE UNIT-1
C languaGE UNIT-1
 
Introduction to c language by nitesh
Introduction to c language by niteshIntroduction to c language by nitesh
Introduction to c language by nitesh
 
Chapter 1: Introduction
Chapter 1: IntroductionChapter 1: Introduction
Chapter 1: Introduction
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 

2