SlideShare uma empresa Scribd logo
1 de 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

Mais conteúdo relacionado

Mais procurados

Mais procurados (20)

Introduction of c programming
Introduction of c programmingIntroduction of c programming
Introduction of c programming
 
Programming in c
Programming in cProgramming in c
Programming in c
 
Structure of C program
Structure of C programStructure of C program
Structure of C program
 
Programming in c Arrays
Programming in c ArraysProgramming in c Arrays
Programming in c Arrays
 
C language unit-1
C language unit-1C language unit-1
C language unit-1
 
C functions
C functionsC functions
C functions
 
User defined functions in C
User defined functions in CUser defined functions in C
User defined functions in C
 
Introduction to c programming language
Introduction to c programming languageIntroduction to c programming language
Introduction to c programming language
 
Basics of C programming
Basics of C programmingBasics of C programming
Basics of C programming
 
Programming in C Presentation upto FILE
Programming in C Presentation upto FILEProgramming in C Presentation upto FILE
Programming in C Presentation upto FILE
 
Typecasting in c
Typecasting in cTypecasting in c
Typecasting in c
 
C language
C languageC language
C language
 
Structures in c language
Structures in c languageStructures in c language
Structures in c language
 
INTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMINGINTRODUCTION TO C PROGRAMMING
INTRODUCTION TO C PROGRAMMING
 
Constants in C Programming
Constants in C ProgrammingConstants in C Programming
Constants in C Programming
 
Introduction to C Programming
Introduction to C ProgrammingIntroduction to C Programming
Introduction to C Programming
 
Functions in c language
Functions in c language Functions in c language
Functions in c language
 
Structure in C
Structure in CStructure in C
Structure in C
 
C introduction by thooyavan
C introduction by  thooyavanC introduction by  thooyavan
C introduction by thooyavan
 
Keywords in c language
Keywords in c languageKeywords in c language
Keywords in c language
 

Destaque

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
 
VGIPM_Conference_CTA_2013_Abstracts[1]
VGIPM_Conference_CTA_2013_Abstracts[1]VGIPM_Conference_CTA_2013_Abstracts[1]
VGIPM_Conference_CTA_2013_Abstracts[1]
Carlos Castilho
 

Destaque (20)

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
 
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
 
The many hidden causes of hip pain
The many hidden causes of hip painThe many hidden causes of hip pain
The many hidden causes of hip pain
 
VGIPM_Conference_CTA_2013_Abstracts[1]
VGIPM_Conference_CTA_2013_Abstracts[1]VGIPM_Conference_CTA_2013_Abstracts[1]
VGIPM_Conference_CTA_2013_Abstracts[1]
 

Semelhante a 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
 

Semelhante a C basics (20)

Introduction of c language
Introduction of c languageIntroduction of c language
Introduction of 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
 
Introduction to C programming
Introduction to C programmingIntroduction to C programming
Introduction to C programming
 
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
 

Mais de 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
 

Último

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
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
SoniaTolstoy
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 

Último (20)

A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.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
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
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 ...
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
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
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
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
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 

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

Notas do Editor

  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