Learn the second lesson of C language--Choose a compiler and start analyzing someone else's code

Source: Internet
Author: User

I heard that now my classmates in the University of general use of the compiler is VC6.0, in order to facilitate their advice, so I just started to choose VC6.0 to learn. But the installation of the process has a variety of problems, I do not want to use the green version, so finally chose the installation of the most convenient dev-c++. I want to start by analyzing someone else's code. The classmate recommended a book to me. Then I began to analyze the code in the book.

Example 1:

Through Baidu and see my classmates in the university gave me the information, I realized:

1. About <stdio.h>

Stdio.h means "standardinput&output."

It means standard input and output header file!

So, to use the standard input and output functions, it is necessary to call this header file!

The standard input and output functions are often one-to-one, commonly used mainly: scanf and printf, gets and puts, GetChar and Putchar.

2.main

The design principle of C is to use the function as the constituent module of the program. The main () function is called the main function, and a C program is always executed from the main () function. The main function calls the other functions (called methods in some OOP languages, such as Java) and, of course, other called functions can call more functions .... This way the entire program runs like a stack, and sometimes we call it the call stack. The main function is both the entry of the program and the exit of the program, and usually we can specify an exit code and then exit to indicate what the final result of the program is.

Since the main function is responsible for the import and export, it is better not to put too much detail logic directly within the main function, which is not conducive to maintenance and expansion. The main function should be as concise as possible, and the specific implementation details should be encapsulated in the called sub-function.

3.printf function:

The printf () function is a formatted output function that is typically used to output information to a standard output device in a prescribed format. The printf () function is called in the format: printf ("< formatted string >", < Parameter table >). Format output, which is a function (defined in stdio.h) that produces formatted output in the C language. Used to output characters to a terminal (display, console, and so on). Format control consists of text and data format descriptions to be output. In addition to using letters, numbers, spaces, and some number symbols, you can use some escape characters to represent special meanings in the text you want to output.

A function that produces formatted output in C (defined in stdio.h). Output to the terminal (display, etc.). This function is widely used in languages such as C, C #, C + +, Java, and PHP.

4. Personal view: It seems that the definition of the statement or something. What about the main function? Where do you declare it?

Go to bed first.

Learn the second lesson of C language--Choose a compiler and start analyzing someone else's code

Related Article

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.