printf(): It is the major predefined output function in C,
available in stdio.h Standard Input Output Header file.
Printf always refers standard output device i.e. monitor.
Syntax:
int printf(“[text] [conversion characters/format
specifiers] “ [, variables ] [ , expressions ] );
Note:
1. Printf always return int that indicate the no of visible
/ printable characters in “ “.
2. In printf execution order right to left but printing is
left to right.
3. In printf the first argument should be in “ “.
4. In printf everything printed as it is except back slash
characters and conversion characters.
5. Printf can perform both formatted and unformatted
outputs.
Example: Write a C program to find string length
without using strlen() or a loop.
In Dev C++:
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
main()
{
printf("Kishore Naidu");
getch();
system("cls");
printf("Vizag");
getch();
system("cls");
printf("Andhra Pradesh");
getch();
}
BACK SLASH / ESCAPE SEQUENCE CHARACTERS
They started with back slash [ \ ].
They used to format the outputs.
They participated in program execution but not
displayed in output. Hence they are also called
escape sequence characters.
Each back slash character=1 byte i.e. one character.
BACK SLASH CHARACTER DESCRIPTION
\a Alert [ beep sound ]
\b Back space
\n New line character
\t Tab space
\r Carriage return[beginning of
line]
\f
Form feed
\v Vertical tab
\0 Null char
\\ \ [ invalid ]
\k k [ invalid ]