C Programming/Basic Output
Objectiveedit
|
LessoneditOutput is information that the program tells the user. The most basic way to do this is writing text to the console. In the previous lesson, we output text to the console using the following program: #include <stdio.h>
int main(void)
{
printf("Hello world!\n\n");
printf("Press any key to continue ...");
getch();
return 0;
}
If you compile the above program and run it, you will get this output: The function
edit
|
Escape Sequence | Description |
---|---|
\' |
Single quote |
\" |
Double quote |
\\ |
Backslash |
\nnn |
Octal number (nnn)* |
\0 |
Null character (really just the octal number zero) |
\a |
Audible bell |
\b |
Backspace |
\f |
Formfeed |
\n |
Newline |
\r |
Carriage return |
\t |
Horizontal tab |
\v |
Vertical tab |
\xnnn |
Hexadecimal number (nnn)* |
* For both Hexadecimal and Octal number escape sequences, \nnn or \xnnn evaluates to a character with character code nnn. For example, \101 evaluates to the character A, as A has the character code of 101 in octal format.
Examples
editFurther reading
edit
Assignmentsedit
|