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

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
+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@
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Recently uploaded (20)

Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
+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...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
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
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 

2