Professional Documents
Culture Documents
Machine Language
Highly portable
Structure of C program
8
Function
function_name (arg1, ar2 … argn) Heading
{
Statement 1
Statement 2
Compound
return data; Statement
}
Composition of a Function
10
Do complex calculations
A flowchart is a diagram that
represents an algorithm
represents the workflow or process,
shows the order of executing the processes.
Flowchart
13
A Sample Program
14
#include<stdio.h>
main()
{
int number = 100;
float sum = 57.26 + 100.1
printf(“%d”,number);
printf(“%.2f”,sum);
}
Variable
15
#include<stdio.h>
main()
{
int number; Type declarations
Assigning value
number = 100;
float sum = 57.26 + 100.1
printf(“%d”,number);
printf(“%.2f”,sum);
}
Identifiers
17
C has 32 keywords
Keywords
auto break case char const continue default do
double else enum extern float for goto if
int long register return short signed sizeof static
struct switch typedef union unsigned void volatile while
Data
Data Type
Types
19
Code Meaning
\n New Line
\b Back Space
\t Horizontal Tab
\v Vertical Tab
\0 NULL
\” Double quote
\’ Single quote
\\ Backslash
\a Alert
\? Question mark
scanf()
22
scanf(“control string”,&variable1,&variable2,…);
format specifier of data being received
scanf(“%d”,&variable);
Reference
23
Programming with C
Chapter 1 : 1.4, 1.5(Introduction to C, Structure of a C Program)
Chapter 2 : 2.1, 2.2, 2.3, 2.4, 2.5(Variables), 2.6, 2.7, 2.8, 2.9
24
Q&A