Example 1: HelloWorld.c
This program print out the word: Hello World on the screen.
/* #include <stdio.h> int main() |
Output: |
- /*, */, //: Comment signs. Everything between /* and */ are comments, all words in a line begin with // are also comments
- #include <stdio.h>:
- int main(){...}: Main function in C, every C program must have a main function, which can return a value or it can return null etc: void main(){...}
- printf: a preset function in stdio.h library, which used to print out a string on the the screen.
ex: printf("Anything string will be printed on to the screen"); -
\n: an escaped character, which equals to a new line character or an enter character. Below are sme escaped characters.
Escape Sequence Represents \a
Bell (alert)
\b
Backspace
\f
Formfeed
\n
New line
\r
Carriage return
\t
Horizontal tab
\v
Vertical tab
\'
Single quotation mark
\"
Double quotation mark
\\
Backslash
\?
Literal question mark
- return 0; return a zero value for main function.