SlideShare ist ein Scribd-Unternehmen logo
1 von 25
 Introduction
 Evolution
 Characteristics
 Structure of program
 Input/output statements
 Command line arguments
 Escape sequences
12/11/2015
Session-1/Dr.M.karthika
2
Dennis M. Ritchie
 C language is one of the most popular
computer language
 structured ,
 low level ,
 machine dependent language
12/11/2015Session-1/Dr.M.karthika 4
 C programming language was developed in
1972 by Dennis Ritchie at bell laboratories of
AT&T(American Telephone & Telegraph),
located in U.S.A.
 It was developed to be used in UNIX
Operating system.
 It inherits many features of previous
languages such as B and BPCL.
12/11/2015Session-1/Dr.M.karthika 5
Language year Developed By
ALGOL 1960 International Group
BPCL 1967 Martin Richards
B 1970 Ken Thompson
Traditional C 1972 Dennis Ritchie
K & R C 1978 Kernighan & Dennis
Ritchie
ANSI C 1989 ANSI Committee
ANSI/ISO C 1990 ISO Committee
C99 1999 Standardization
Committee
 C is mother language of all programming
language.
 It is system programming language.
 It is procedure-oriented programming
language.
 It is also called mid level programming
language.
There are many features of c language are given below.
1) Simple
2) Machine Independent or Portable
3) Mid-level programming language
4) structured programming language
5) Rich Library
6) Memory Management
7) Fast Speed
8) Pointers
9) Recursion
10) Extensible
A sample C Program
#include<stdio.h>
int main()
{
--other statements
// Comments after double slash
}
Friday, December 11, 2015 9
 Type a program
 Save it
 Compile the program – This will generate an
exe file (executable)
 Run the program (Actually the exe created out
of compilation will run and not the .c file)
 In different compiler we have different option
for compiling and running. We give only the
concepts.
Friday, December 11, 2015 10
 #include <stdio.h> includes the standard input
output library functions.
 The printf() function is defined in stdio.h .
 #include <conio.h> includes the console input
output library functions.
 The getch() function is defined in conio.h file.
 void main() The main() function is the entry point
of every program in c language.
 The void keyword specifies that it returns no value.
 printf() The printf() function is used to print data on
the console.
 getch() The getch() function asks for a single
character. Until you press any key, it blocks the screen.
 The files that are specified in the include section
is called as header file
 These are precompiled files that has some
functions defined in them
 We can call those functions in our program by
supplying parameters
 Header file is given an extension .h
 C Source file is given an extension .c
 This is the entry point of a program
 When a file is executed, the start point is the
main function
 From main function the flow goes as per the
programmers choice.
 There may or may not be other functions
written by user in a program
 Main function is compulsory for any C program
 #include <stdio.h> includes the standard input
output library functions. The printf() function is defined
in stdio.h .
 #include <conio.h> includes the console input
output library functions. The getch() function is defined
in conio.h file.
 void main() The main() function is the entry point
of every program in c language. The void keyword
specifies that it returns no value.
 printf() The printf() function is used to print data on
the console.
 getch() The getch() function asks for a single
character. Until you press any key, it blocks the screen.
#include <stdio.h>
#include <conio.h>
void main(){
printf("Hello C Language");
getch();
}
Hello C Language
There are two input output function of c
language.
1) First is printf()
2) Second is scanf()
 printf() function is used for output.
It prints the given statement to the console.
 Syntax of printf() is given below:
printf(“format string”,arguments_list);
 Format string can be
%d (integer),
%c (character),
%s (string),
%f (float) etc.
12/11/2015Session-1/Dr.M.karthika 18
 scanf() Function: is used for input. It reads
the input data from console.
 scanf(“format string”,argument_list);
 Input
› scanf(“%d”,&a);
› Gets an integer value from the user and stores it
under the name “a”
 Output
› printf(“%d”,a);
› Prints the value present in variable a on the
screen
Friday, December 11, 2015 20
 Single line comment
› // (double slash)
› Termination of comment is by pressing enter key
 Multi line comment
/*….
…….*/
This can span over to multiple lines
Friday, December 11, 2015 21
12/11/2015Session-1/Dr.M.karthika 22
Constant Meaning
‘a’ Audible Alert (Bell)
‘b’ Back Space
‘f’ Form Feed
‘n’ New Line
‘r’ Carriage Return
‘t’ Horizontal Tab
‘v’ Vertical Tab
”’ Single Quote
‘”‘ Double Quote
‘?’ Question Mark
‘’ Backslash
‘0’ Null
Escape Sequences
 /* Testing the escape sequences */
#include <stdio.h>
int main(void)
{
printf("Testing the escape sequences:n");
printf("-----------------------------n");
/* 3 times audible tone */
printf("The audible bell ---> a aaan");
printf("The backspace ---> b___ bTestingn");
/* printer must be attached...*/
printf("The formfeed, printer ---> f fTestn");
printf("The newline ---> n nn");
printf("The carriage return ---> r rTestingrn");
printf("The horizontal tab ---> t tTestingtn");
printf("The vertical tab ---> v Testingvn");
printf("The backslash --->  Testingn");
printf("The single quote ---> ' 'Testing'''n");
printf("The double quote ---> " "Testing""n");
printf("Some might not work isn't it?n");
return 0;
}
 Output example:
Testing the escape sequences:
-----------------------------
The audible bell ---> a
The backspace ---> b___Testing
The formfeed, printer ---> f ?Test
The newline ---> n
Testingriage return ---> r
The horizontal tab ---> t Testing
The vertical tab ---> v Testing?
The backslash --->  Testing
The single quote ---> ' 'Testing' ' '
The double quote ---> " "Testing""
Some might not work isn't it?
Press any key to continue . . .
12/11/2015Session-1/Dr.M.karthika 23
12/11/2015Session-1/Dr.M.karthika 24
12/11/2015Session-1/Dr.M.karthika 25

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

Function in C
Function in CFunction in C
Function in C
 
Introduction to c programming language
Introduction to c programming languageIntroduction to c programming language
Introduction to c programming language
 
C Language
C LanguageC Language
C Language
 
Function in c program
Function in c programFunction in c program
Function in c program
 
Storage class in C Language
Storage class in C LanguageStorage class in C Language
Storage class in C Language
 
C presentation book
C presentation bookC presentation book
C presentation book
 
C tokens
C tokensC tokens
C tokens
 
C Programming Unit-1
C Programming Unit-1C Programming Unit-1
C Programming Unit-1
 
Loops in c
Loops in cLoops in c
Loops in c
 
Character set of c
Character set of cCharacter set of c
Character set of c
 
Variables in C Programming
Variables in C ProgrammingVariables in C Programming
Variables in C Programming
 
C keywords and identifiers
C keywords and identifiersC keywords and identifiers
C keywords and identifiers
 
Conditional Statement in C Language
Conditional Statement in C LanguageConditional Statement in C Language
Conditional Statement in C Language
 
Features of c language 1
Features of c language 1Features of c language 1
Features of c language 1
 
Introduction to C programming
Introduction to C programmingIntroduction to C programming
Introduction to C programming
 
C fundamental
C fundamentalC fundamental
C fundamental
 
Programming in C Presentation upto FILE
Programming in C Presentation upto FILEProgramming in C Presentation upto FILE
Programming in C Presentation upto FILE
 
Scope rules : local and global variables
Scope rules : local and global variablesScope rules : local and global variables
Scope rules : local and global variables
 
C PROGRAMMING
C PROGRAMMINGC PROGRAMMING
C PROGRAMMING
 
Preprocessor
PreprocessorPreprocessor
Preprocessor
 

Andere mochten auch

Goal Decomposition and Abductive Reasoning for Policy Analysis and Refinement
Goal Decomposition and Abductive Reasoning for Policy Analysis and RefinementGoal Decomposition and Abductive Reasoning for Policy Analysis and Refinement
Goal Decomposition and Abductive Reasoning for Policy Analysis and Refinement
Emil Lupu
 
Model Evolution Workshop at MODELS 2010
Model Evolution Workshop at MODELS 2010Model Evolution Workshop at MODELS 2010
Model Evolution Workshop at MODELS 2010
Matthias Biehl
 
04 control structures 1
04 control structures 104 control structures 1
04 control structures 1
Jomel Penalba
 

Andere mochten auch (20)

Basics of C programming
Basics of C programmingBasics of C programming
Basics of C programming
 
Dose baixa versus dose elevada
Dose baixa versus dose elevadaDose baixa versus dose elevada
Dose baixa versus dose elevada
 
Chapter 5:Understanding Variable Scope and Class Construction
Chapter 5:Understanding Variable Scope and Class ConstructionChapter 5:Understanding Variable Scope and Class Construction
Chapter 5:Understanding Variable Scope and Class Construction
 
10. Function I
10. Function I10. Function I
10. Function I
 
Program Logic Formulation - Ohio State University
Program Logic Formulation - Ohio State UniversityProgram Logic Formulation - Ohio State University
Program Logic Formulation - Ohio State University
 
Goal Decomposition and Abductive Reasoning for Policy Analysis and Refinement
Goal Decomposition and Abductive Reasoning for Policy Analysis and RefinementGoal Decomposition and Abductive Reasoning for Policy Analysis and Refinement
Goal Decomposition and Abductive Reasoning for Policy Analysis and Refinement
 
Type Conversion, Precedence and Associativity
Type Conversion, Precedence and AssociativityType Conversion, Precedence and Associativity
Type Conversion, Precedence and Associativity
 
Model Evolution Workshop at MODELS 2010
Model Evolution Workshop at MODELS 2010Model Evolution Workshop at MODELS 2010
Model Evolution Workshop at MODELS 2010
 
04 control structures 1
04 control structures 104 control structures 1
04 control structures 1
 
Typecasting in c
Typecasting in cTypecasting in c
Typecasting in c
 
Escape sequences
Escape sequencesEscape sequences
Escape sequences
 
Storage classes
Storage classesStorage classes
Storage classes
 
C language Unit 2 Slides, UPTU C language
C language Unit 2 Slides, UPTU C languageC language Unit 2 Slides, UPTU C language
C language Unit 2 Slides, UPTU C language
 
Presentation influence texture or crystallography orientations on magnetic pr...
Presentation influence texture or crystallography orientations on magnetic pr...Presentation influence texture or crystallography orientations on magnetic pr...
Presentation influence texture or crystallography orientations on magnetic pr...
 
Storage classes
Storage classesStorage classes
Storage classes
 
C pointers
C pointersC pointers
C pointers
 
Coper in C
Coper in CCoper in C
Coper in C
 
The 8 different sub disciplines of urology
The 8 different sub disciplines of urologyThe 8 different sub disciplines of urology
The 8 different sub disciplines of urology
 
Bespoke glasses | Cool Eyewear
Bespoke glasses | Cool EyewearBespoke glasses | Cool Eyewear
Bespoke glasses | Cool Eyewear
 
exhibitions,event planning,designers,events management,companies,contractors
exhibitions,event planning,designers,events management,companies,contractorsexhibitions,event planning,designers,events management,companies,contractors
exhibitions,event planning,designers,events management,companies,contractors
 

Ähnlich wie C basics

C Unit 1 notes PREPARED BY MVB REDDY
C Unit 1 notes PREPARED BY MVB REDDYC Unit 1 notes PREPARED BY MVB REDDY
C Unit 1 notes PREPARED BY MVB REDDY
Rajeshkumar Reddy
 

Ähnlich wie C basics (20)

Introduction of c language
Introduction of c languageIntroduction of c language
Introduction of c language
 
C language
C languageC language
C language
 
Introduction to C Unit 1
Introduction to C Unit 1Introduction to C Unit 1
Introduction to C Unit 1
 
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
 
introduction to c programming language
introduction to c programming languageintroduction to c programming language
introduction to c programming language
 
Programming in c
Programming in cProgramming in c
Programming in c
 
c_pro_introduction.pptx
c_pro_introduction.pptxc_pro_introduction.pptx
c_pro_introduction.pptx
 
C_Intro.ppt
C_Intro.pptC_Intro.ppt
C_Intro.ppt
 
Intro to cprogramming
Intro to cprogrammingIntro to cprogramming
Intro to cprogramming
 
C structure
C structureC structure
C structure
 
Chapter 1 Introduction to C .pptx
Chapter 1 Introduction to C .pptxChapter 1 Introduction to C .pptx
Chapter 1 Introduction to C .pptx
 
Unit 2 introduction to c programming
Unit 2   introduction to c programmingUnit 2   introduction to c programming
Unit 2 introduction to c programming
 
Unit 1 c - all topics
Unit 1   c - all topicsUnit 1   c - all topics
Unit 1 c - all topics
 
C notes diploma-ee-3rd-sem
C notes diploma-ee-3rd-semC notes diploma-ee-3rd-sem
C notes diploma-ee-3rd-sem
 
C Unit 1 notes PREPARED BY MVB REDDY
C Unit 1 notes PREPARED BY MVB REDDYC Unit 1 notes PREPARED BY MVB REDDY
C Unit 1 notes PREPARED BY MVB REDDY
 
C language tutorial
C language tutorialC language tutorial
C language tutorial
 
C programming presentation(final)
C programming presentation(final)C programming presentation(final)
C programming presentation(final)
 
Overview of c
Overview of cOverview of c
Overview of c
 
C notes.pdf
C notes.pdfC notes.pdf
C notes.pdf
 
(Lect. 2 & 3) Introduction to C.ppt
(Lect. 2 & 3) Introduction to C.ppt(Lect. 2 & 3) Introduction to C.ppt
(Lect. 2 & 3) Introduction to C.ppt
 

Mehr von thirumalaikumar3 (8)

Data type in c
Data type in cData type in c
Data type in c
 
Control flow in c
Control flow in cControl flow in c
Control flow in c
 
C function
C functionC function
C function
 
Structure c
Structure cStructure c
Structure c
 
String c
String cString c
String c
 
File handling in c
File  handling in cFile  handling in c
File handling in c
 
File handling-c programming language
File handling-c programming languageFile handling-c programming language
File handling-c programming language
 
Data type2 c
Data type2 cData type2 c
Data type2 c
 

Kürzlich hochgeladen

Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 

Kürzlich hochgeladen (20)

Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
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
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
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
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
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
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 

C basics

  • 1.
  • 2.  Introduction  Evolution  Characteristics  Structure of program  Input/output statements  Command line arguments  Escape sequences 12/11/2015 Session-1/Dr.M.karthika 2
  • 4.  C language is one of the most popular computer language  structured ,  low level ,  machine dependent language 12/11/2015Session-1/Dr.M.karthika 4
  • 5.  C programming language was developed in 1972 by Dennis Ritchie at bell laboratories of AT&T(American Telephone & Telegraph), located in U.S.A.  It was developed to be used in UNIX Operating system.  It inherits many features of previous languages such as B and BPCL. 12/11/2015Session-1/Dr.M.karthika 5
  • 6. Language year Developed By ALGOL 1960 International Group BPCL 1967 Martin Richards B 1970 Ken Thompson Traditional C 1972 Dennis Ritchie K & R C 1978 Kernighan & Dennis Ritchie ANSI C 1989 ANSI Committee ANSI/ISO C 1990 ISO Committee C99 1999 Standardization Committee
  • 7.  C is mother language of all programming language.  It is system programming language.  It is procedure-oriented programming language.  It is also called mid level programming language.
  • 8. There are many features of c language are given below. 1) Simple 2) Machine Independent or Portable 3) Mid-level programming language 4) structured programming language 5) Rich Library 6) Memory Management 7) Fast Speed 8) Pointers 9) Recursion 10) Extensible
  • 9. A sample C Program #include<stdio.h> int main() { --other statements // Comments after double slash } Friday, December 11, 2015 9
  • 10.  Type a program  Save it  Compile the program – This will generate an exe file (executable)  Run the program (Actually the exe created out of compilation will run and not the .c file)  In different compiler we have different option for compiling and running. We give only the concepts. Friday, December 11, 2015 10
  • 11.  #include <stdio.h> includes the standard input output library functions.  The printf() function is defined in stdio.h .  #include <conio.h> includes the console input output library functions.  The getch() function is defined in conio.h file.  void main() The main() function is the entry point of every program in c language.  The void keyword specifies that it returns no value.  printf() The printf() function is used to print data on the console.  getch() The getch() function asks for a single character. Until you press any key, it blocks the screen.
  • 12.  The files that are specified in the include section is called as header file  These are precompiled files that has some functions defined in them  We can call those functions in our program by supplying parameters  Header file is given an extension .h  C Source file is given an extension .c
  • 13.  This is the entry point of a program  When a file is executed, the start point is the main function  From main function the flow goes as per the programmers choice.  There may or may not be other functions written by user in a program  Main function is compulsory for any C program
  • 14.  #include <stdio.h> includes the standard input output library functions. The printf() function is defined in stdio.h .  #include <conio.h> includes the console input output library functions. The getch() function is defined in conio.h file.  void main() The main() function is the entry point of every program in c language. The void keyword specifies that it returns no value.  printf() The printf() function is used to print data on the console.  getch() The getch() function asks for a single character. Until you press any key, it blocks the screen.
  • 15. #include <stdio.h> #include <conio.h> void main(){ printf("Hello C Language"); getch(); }
  • 17. There are two input output function of c language. 1) First is printf() 2) Second is scanf()
  • 18.  printf() function is used for output. It prints the given statement to the console.  Syntax of printf() is given below: printf(“format string”,arguments_list);  Format string can be %d (integer), %c (character), %s (string), %f (float) etc. 12/11/2015Session-1/Dr.M.karthika 18
  • 19.  scanf() Function: is used for input. It reads the input data from console.  scanf(“format string”,argument_list);
  • 20.  Input › scanf(“%d”,&a); › Gets an integer value from the user and stores it under the name “a”  Output › printf(“%d”,a); › Prints the value present in variable a on the screen Friday, December 11, 2015 20
  • 21.  Single line comment › // (double slash) › Termination of comment is by pressing enter key  Multi line comment /*…. …….*/ This can span over to multiple lines Friday, December 11, 2015 21
  • 22. 12/11/2015Session-1/Dr.M.karthika 22 Constant Meaning ‘a’ Audible Alert (Bell) ‘b’ Back Space ‘f’ Form Feed ‘n’ New Line ‘r’ Carriage Return ‘t’ Horizontal Tab ‘v’ Vertical Tab ”’ Single Quote ‘”‘ Double Quote ‘?’ Question Mark ‘’ Backslash ‘0’ Null Escape Sequences
  • 23.  /* Testing the escape sequences */ #include <stdio.h> int main(void) { printf("Testing the escape sequences:n"); printf("-----------------------------n"); /* 3 times audible tone */ printf("The audible bell ---> a aaan"); printf("The backspace ---> b___ bTestingn"); /* printer must be attached...*/ printf("The formfeed, printer ---> f fTestn"); printf("The newline ---> n nn"); printf("The carriage return ---> r rTestingrn"); printf("The horizontal tab ---> t tTestingtn"); printf("The vertical tab ---> v Testingvn"); printf("The backslash ---> Testingn"); printf("The single quote ---> ' 'Testing'''n"); printf("The double quote ---> " "Testing""n"); printf("Some might not work isn't it?n"); return 0; }  Output example: Testing the escape sequences: ----------------------------- The audible bell ---> a The backspace ---> b___Testing The formfeed, printer ---> f ?Test The newline ---> n Testingriage return ---> r The horizontal tab ---> t Testing The vertical tab ---> v Testing? The backslash ---> Testing The single quote ---> ' 'Testing' ' ' The double quote ---> " "Testing"" Some might not work isn't it? Press any key to continue . . . 12/11/2015Session-1/Dr.M.karthika 23

Hinweis der Redaktion

  1. Format specifiers %d is the format specifier. This informs to the compiler that the incoming value is an integer value. Other data types can be specified as follows: %c – character %f – float %lf – double %s – character array (string) Printf and scanf are defined under the header file stdio.h