<01> Main function Analysis + Create a new Target+c language program execution flow

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.