SlideShare une entreprise Scribd logo
1  sur  13
Instructions are very much similar to sentences/statements in
English language. It is the combination of various tokens,
character set elements to perform a desired task/output to
help a program make it complete.
OR
Instructions in C are the commands in the program that will
instruct C compiler to perform specific tasks or actions.
Whenever we write a C instruction, we are telling C compiler
to do a task for us.
Following are the categories of instructions:
 Declaration instructions
 Input/output instructions
 Assignment instructions
 Arithmetic/logical instructions
 Control instructions
These are used to declare different kind of variable
further to be used by the C program.
Eg:- we want to make a program and declare the variable
suppose, we want to write the area of rectangle. So the
declaration is
int A, B, Area;
OR
int l, b, area;
We want to add two numbers, then the declarations is
int A, B, sum;
Input instructions are used for supplying values to the
variables as declared in declarative instructions.
Eg:- (Statically supplying the values to the variables)
A=10;
B=20;
Where the values of variables are fixed.
(for dynamically supplying the value)
then we use a C library function called scanf( )
output instructions are used for printing the output after the
execution of instructions.
Then we use a C library function called printf( );
These are used for assigning the values in proper order to the
variables.
int A, B, C;
printf(“Enter the first number”);
scanf(“%d”,&A);
printf(“Enter the second number”);
scanf(“%d”,&B);
printf(“Enter the third number”);
scanf(“%d”,&C);
These are used for applying the arithmetic formula or logic to
solve the problems.
Eg:- we need to give a logical instruction to out program
area=l * b;
OR
area = A * B;
These are used to control the flow of execution of the
program.
SR.NO
.
TYPES & DESCRIPTION
1 Basic Types
They are arithmetic types and are further classified into: (a)
integer types and (b) floating-point types.
2 Enumerated types
It is a user defined data type. It gives numbers to the name.
3 The type void
The type especifier void indicates that no value is available.
4 Derived types
They include (a) Pointer types, (b) Array types, (c) Structure
types, (d) Union types (e) Function types.
TYPE SIZE RANGE FORMAT
SPECIFIER
Int or signed int 2 -32768 to 32767 %d,%i
Unsigned int 2 0 to 65535 %u
Short int or signed
short int
1 -128 to 127 %hd
Unsigned short int 1 0 to 255 %hu
Long int or signed
long int
4 -2,147,483,648 to
2,147,483,647
%ld
Unsigned long int 4 0 to 4,294,967,295 %lu
Float 4 3.4E-38 to 3.4E+38 %f
Double 8 1.7E-308 to
1.7E+308
%lf
Long double 10 3.4E-4932 to
1.1E+4932
%Lf or %LF
Char or signed char 1 -128 to 127 %c
Unsigned char 1 0 to 255 %c
#include<stdio.h>
#include<conio.h>
void main( )
{
int A, B, C;
clrscr( );
printf(“Enter the first number-”);
scanf(“%d”,&A);
printf(“Enter the second number-”);
scanf(“%d”,&B);
C=A+B;
printf(“%d”,C);
getch( );
}
Header section
Program execution starts with main( ) function
Declaration section
Clearing the screen function
Assignment section
Arithmetic section
Printing output statement
Take input from keyboard
Body
section
stdio.h
Standard input output header file
This header files contains the definition of standard
Input output functions used by a C program.
Eg:- printf( ); scanf( );
Output Input
conio.h
Console input ouput header file
This header file contains the definition of standard
input output functions used by C program related to
console input output devices.
Eg:- keyboard for input
monitor for output
The function needed for supplying the input data via
keyboard and to get output data via monitor are
defined inside <conio.h> library header file.
clrscr( ); getch( );
Clear the
screen
Get character
void main( )
C compiler starts its compilation from main( ).
Before compilation these is another process known
as pre-processing takes place.
During pre-processing, the header files are to be
declared in this section.
Some important points to be noted while you make any
program
 C program is case sensitive
 All the statements are end with semicolon ( ; )
 You must have to include header files
 Space values are ignored in C.

Contenu connexe

Tendances

La5 Basicelement
La5 BasicelementLa5 Basicelement
La5 Basicelement
Cma Mohd
 
Ch2 introduction to c
Ch2 introduction to cCh2 introduction to c
Ch2 introduction to c
Hattori Sidek
 
C programming | Class 8 | III Term
C programming  | Class 8  | III TermC programming  | Class 8  | III Term
C programming | Class 8 | III Term
Andrew Raj
 

Tendances (20)

Cnotes
CnotesCnotes
Cnotes
 
datatypes and variables in c language
 datatypes and variables in c language datatypes and variables in c language
datatypes and variables in c language
 
Assignment2
Assignment2Assignment2
Assignment2
 
La5 Basicelement
La5 BasicelementLa5 Basicelement
La5 Basicelement
 
Assignment5
Assignment5Assignment5
Assignment5
 
Ch2 introduction to c
Ch2 introduction to cCh2 introduction to c
Ch2 introduction to c
 
Ch3 repetition
Ch3 repetitionCh3 repetition
Ch3 repetition
 
Modula 2 tutorial - 003 - declarations
Modula 2 tutorial - 003 - declarationsModula 2 tutorial - 003 - declarations
Modula 2 tutorial - 003 - declarations
 
Flowchart - Introduction and Designing Tools
Flowchart - Introduction and Designing ToolsFlowchart - Introduction and Designing Tools
Flowchart - Introduction and Designing Tools
 
Casa lab manual
Casa lab manualCasa lab manual
Casa lab manual
 
Handout#09
Handout#09Handout#09
Handout#09
 
Variables in C Programming
Variables in C ProgrammingVariables in C Programming
Variables in C Programming
 
COMPUTER PROGRAMMING
COMPUTER PROGRAMMINGCOMPUTER PROGRAMMING
COMPUTER PROGRAMMING
 
CP Handout#2
CP Handout#2CP Handout#2
CP Handout#2
 
C programming | Class 8 | III Term
C programming  | Class 8  | III TermC programming  | Class 8  | III Term
C programming | Class 8 | III Term
 
CP Handout#1
CP Handout#1CP Handout#1
CP Handout#1
 
COM1407: Program Control Structures – Decision Making & Branching
COM1407: Program Control Structures – Decision Making & BranchingCOM1407: Program Control Structures – Decision Making & Branching
COM1407: Program Control Structures – Decision Making & Branching
 
Complete C programming Language Course
Complete C programming Language CourseComplete C programming Language Course
Complete C programming Language Course
 
programming fortran 77 Slide01
programming fortran 77 Slide01programming fortran 77 Slide01
programming fortran 77 Slide01
 
Fortran 90 Basics
Fortran 90 BasicsFortran 90 Basics
Fortran 90 Basics
 

Similaire à C programming language for beginners

C basics 4 std11(GujBoard)
C basics 4 std11(GujBoard)C basics 4 std11(GujBoard)
C basics 4 std11(GujBoard)
indrasir
 

Similaire à C programming language for beginners (20)

Sample for Simple C Program - R.D.Sivakumar
Sample for Simple C Program - R.D.SivakumarSample for Simple C Program - R.D.Sivakumar
Sample for Simple C Program - R.D.Sivakumar
 
Fundamental of C Programming Language and Basic Input/Output Function
  Fundamental of C Programming Language and Basic Input/Output Function  Fundamental of C Programming Language and Basic Input/Output Function
Fundamental of C Programming Language and Basic Input/Output Function
 
Introduction to C Programming
Introduction to C ProgrammingIntroduction to C Programming
Introduction to C Programming
 
Unit 4 Foc
Unit 4 FocUnit 4 Foc
Unit 4 Foc
 
C basics 4 std11(GujBoard)
C basics 4 std11(GujBoard)C basics 4 std11(GujBoard)
C basics 4 std11(GujBoard)
 
Chapter3
Chapter3Chapter3
Chapter3
 
UNIT-II CP DOC.docx
UNIT-II CP DOC.docxUNIT-II CP DOC.docx
UNIT-II CP DOC.docx
 
C programing Tutorial
C programing TutorialC programing Tutorial
C programing Tutorial
 
Unit 2- Module 2.pptx
Unit 2- Module 2.pptxUnit 2- Module 2.pptx
Unit 2- Module 2.pptx
 
C programming
C programmingC programming
C programming
 
C programming
C programmingC programming
C programming
 
unit_2 (1).pptx
unit_2 (1).pptxunit_2 (1).pptx
unit_2 (1).pptx
 
C Programming Unit-1
C Programming Unit-1C Programming Unit-1
C Programming Unit-1
 
Unit 2 CMath behind coding.pptx
Unit 2 CMath behind coding.pptxUnit 2 CMath behind coding.pptx
Unit 2 CMath behind coding.pptx
 
Chapter1.pptx
Chapter1.pptxChapter1.pptx
Chapter1.pptx
 
Introduction to programming c and data structures
Introduction to programming c and data structuresIntroduction to programming c and data structures
Introduction to programming c and data structures
 
Basic of C Programming | 2022 Updated | By Shamsul H. Ansari
Basic of C Programming | 2022 Updated | By Shamsul H. AnsariBasic of C Programming | 2022 Updated | By Shamsul H. Ansari
Basic of C Programming | 2022 Updated | By Shamsul H. Ansari
 
CPU INPUT OUTPUT
CPU INPUT OUTPUT CPU INPUT OUTPUT
CPU INPUT OUTPUT
 
First c program
First c programFirst c program
First c program
 
the refernce of programming C notes ppt.pptx
the refernce of programming C notes ppt.pptxthe refernce of programming C notes ppt.pptx
the refernce of programming C notes ppt.pptx
 

Dernier

The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
MateoGardella
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 

Dernier (20)

The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 

C programming language for beginners

  • 1.
  • 2. Instructions are very much similar to sentences/statements in English language. It is the combination of various tokens, character set elements to perform a desired task/output to help a program make it complete. OR Instructions in C are the commands in the program that will instruct C compiler to perform specific tasks or actions. Whenever we write a C instruction, we are telling C compiler to do a task for us.
  • 3. Following are the categories of instructions:  Declaration instructions  Input/output instructions  Assignment instructions  Arithmetic/logical instructions  Control instructions
  • 4. These are used to declare different kind of variable further to be used by the C program. Eg:- we want to make a program and declare the variable suppose, we want to write the area of rectangle. So the declaration is int A, B, Area; OR int l, b, area; We want to add two numbers, then the declarations is int A, B, sum;
  • 5. Input instructions are used for supplying values to the variables as declared in declarative instructions. Eg:- (Statically supplying the values to the variables) A=10; B=20; Where the values of variables are fixed. (for dynamically supplying the value) then we use a C library function called scanf( ) output instructions are used for printing the output after the execution of instructions. Then we use a C library function called printf( );
  • 6. These are used for assigning the values in proper order to the variables. int A, B, C; printf(“Enter the first number”); scanf(“%d”,&A); printf(“Enter the second number”); scanf(“%d”,&B); printf(“Enter the third number”); scanf(“%d”,&C);
  • 7. These are used for applying the arithmetic formula or logic to solve the problems. Eg:- we need to give a logical instruction to out program area=l * b; OR area = A * B; These are used to control the flow of execution of the program.
  • 8. SR.NO . TYPES & DESCRIPTION 1 Basic Types They are arithmetic types and are further classified into: (a) integer types and (b) floating-point types. 2 Enumerated types It is a user defined data type. It gives numbers to the name. 3 The type void The type especifier void indicates that no value is available. 4 Derived types They include (a) Pointer types, (b) Array types, (c) Structure types, (d) Union types (e) Function types.
  • 9. TYPE SIZE RANGE FORMAT SPECIFIER Int or signed int 2 -32768 to 32767 %d,%i Unsigned int 2 0 to 65535 %u Short int or signed short int 1 -128 to 127 %hd Unsigned short int 1 0 to 255 %hu Long int or signed long int 4 -2,147,483,648 to 2,147,483,647 %ld Unsigned long int 4 0 to 4,294,967,295 %lu Float 4 3.4E-38 to 3.4E+38 %f Double 8 1.7E-308 to 1.7E+308 %lf Long double 10 3.4E-4932 to 1.1E+4932 %Lf or %LF Char or signed char 1 -128 to 127 %c Unsigned char 1 0 to 255 %c
  • 10. #include<stdio.h> #include<conio.h> void main( ) { int A, B, C; clrscr( ); printf(“Enter the first number-”); scanf(“%d”,&A); printf(“Enter the second number-”); scanf(“%d”,&B); C=A+B; printf(“%d”,C); getch( ); } Header section Program execution starts with main( ) function Declaration section Clearing the screen function Assignment section Arithmetic section Printing output statement Take input from keyboard Body section
  • 11. stdio.h Standard input output header file This header files contains the definition of standard Input output functions used by a C program. Eg:- printf( ); scanf( ); Output Input
  • 12. conio.h Console input ouput header file This header file contains the definition of standard input output functions used by C program related to console input output devices. Eg:- keyboard for input monitor for output The function needed for supplying the input data via keyboard and to get output data via monitor are defined inside <conio.h> library header file. clrscr( ); getch( ); Clear the screen Get character
  • 13. void main( ) C compiler starts its compilation from main( ). Before compilation these is another process known as pre-processing takes place. During pre-processing, the header files are to be declared in this section. Some important points to be noted while you make any program  C program is case sensitive  All the statements are end with semicolon ( ; )  You must have to include header files  Space values are ignored in C.