printf()
function is used.See this program on how to use printf is a program that shows how to printf()
is used.
scanf()
function is used.scanf()
is used.printf()
and scanf()
functions are provided by the standard input/output header <stdio.h>
printf()
function usually involves using escape sequences and format specifiers\n
is called the escape character.\n
means newlineFollowing table lists escape sequences and their description:
Escape Sequence | Description | Escape Sequence | Description | Escape Sequence | Description |
---|---|---|---|---|---|
\a | Alarm | \t | tab | \? | question mark |
\b | backspace | \v | vertical tab | \000 | octal number |
\f | Form feed | \ | backslash | \xhh | hexadecimal number |
\n | new line | ' | single quote | \0 | Null |
\r | carriage return | " | double quote |
scanf()
function accepts 2 argumentsscanf("%d", &numb)
%d
indicates that the data should be an integerFollowing table lists the format specifiers and their description:
Format Specifier | Description |
---|---|
%d | Integer Format Specifier |
%f | Float Format Specifier |
%c | Character Format Specifier |
%s | String Format Specifier |
%u | Unsigned Integer Format Specifier |
%ld | Long Int Format Specifier |