C language HelloWorld template
Before the first to write a C language program you first need to understand some basic knowledge of the C language.
Basics
First, a comment
1, line comments
//
2, block comment
/* */
Second, the header file
1, the operation import library
// import library operating the include
// import a file stdio.h (std is a standard library, i is input, o is output, .h file header. Stdio library) // <> indicates the file into the system, "" represents import a customization file #include <stdio.h>
Third, function
1, function
// int data type, integer, if there is the return value represents a function in the function // main function man program, the program is only one primary function, () a parameter indicative of which parameters can be a function of a plurality of functions, intermediate separated by commas // {} function body, the body of code, the program body // ; end of each statement int main () {};
Write a HelloWorld
Features:
1, print hello word!
#include <stdio.h> int main() { printf("hello word!"); return 0; }
analysis:
#include <stdio.h>
int main () { // the printf function from stdio.h system is provided showing the standard print on the output device, "" a string of the printf ( " Hello World! " ); / / return If the end of the other functions shown in the function, if present in the main function end programs // the return value of 0 represents a function, the function to return the value corresponding to the type and return 0 ; }