C Language Basics Tutorial (v) functions (1)

Source: Internet
Author: User
Tags mathematical functions
A C program consists of a set of external objects, either variables or functions. A function is a self-contained snippet of execution code that completes a certain related function. We can think of a function as a "black box", you just send the data to get the results, and the function inside how exactly how to work, the external program is not known. What the external program knows is limited to what the input gives to the function and what the function outputs. Functions provide a means of programming that makes it easy to read, write, understand, troubleshoot, modify, and maintain.
The number of functions in the C program is actually unlimited, if there is any limit, that is, a C program must have at least one function, and there must be one and only one in the name of main, this function is called the main function, the entire program from this main function to begin execution.
The C language program encourages and advocates people to divide a big problem into one child problem, corresponding to solve a child problem to compile a function, therefore, C language program is generally by a large number of small functions rather than by a small number of large functions, which is called "small functions constitute a large program." The advantage of this is that each part is fully independent of each other and has a single task. Therefore, these fully independent small modules can also be used as a fixed specification of small "components" to form a new large program.
A major feature of the C language is the creation of library functions. Turbo C2.0 has more than 400 functions available in the runtime library, and each function completes certain functions that can be invoked by the user at will. These functions are generally divided into input and output functions, mathematical functions, string and memory functions, BIOS and DOS-related functions, character screens and graphical functional functions, Process control functions, directory functions, and so on. These library functions should be familiar with their functions, only in this way can save a lot of unnecessary work.
The latter part of this tutorial specifically describes the library functions of Turbo C2.0, a routine is given for each function, and the reader can define the part as a block, then write the block to the file, so that it can be called directly after entering the Turbo C2.0 integrated development environment, connecting, running, and observing the results To deepen the understanding of the function.
The user compiles the Turbo C language source program, is uses the turbo C the library function. You can put all the library functions you use in a large main function, or you can design a user function by different functions and be called by other functions. Turbo C2.0 advises users to use the latter, and when users have compiled some of the more commonly used functions, as long as they are in the library of functions, they can be easily invoked in later programming without having to compile them. The connection will automatically assemble the desired program from the appropriate library.
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.