1, C language of the source program suffix:. C format
2. C Language Source program:
1) composed of functions
2) in a program, there is only one main function (the main function is called by the system)
3) function is only executed when it is called.
4) If no main function program cannot run
5) End of sentence in C language must have a semicolon
3, the main function of the wording:
int main () {
printf ("Hello World");
return 0;
}
4. Implementation of C language program
1) command+r
2. Tap the triangle symbol in the top left corner
Program ended with exit code:0 execution End and exit
5, C language source program analysis:
This is the main function of the C language.
int main () {//int indicates the return value of the main function
Main is the name of the main function
() is the parameter of the main function, if there is nothing in the parentheses, it means no parameters
{} indicates that this is a function body
printf ("Hello World"); printf is a function that is a function provided by the system
Function: Output A string to the console
printf has a parameter, the parameter is: "Hello World"
\ n Indicates the output, line break
return 0; return 0; Indicates that the main function returns to the system a 0
Indicates that the program is executing properly and has exited
}
Problem:
Yellow exclamation point: This sentence has a warning (warning does not affect the operation of the program)
Red Circle: Error (Error must affect program execution)
The goal of the writing program:
0 Warning 0 Bug
6. C Language Program execution flow
1) Write source file
Compile
---->. o suffix of the target file
Link
------>.out Suffix executable file
----> Start execution
Referencing a header file
#include <stdio.h>//indicates printf is the function in the stdio.h file
int main () {
Call the system's function printf
printf ("Hello world\n");
return 0;
}
<01> Main function Analysis + Create a new Target+c language program execution flow