C Language: Basic concepts of functions

Source: Internet
Author: User

Function: Complete a specific function code block

Function: Manage the Code

Advantages of the function: improve the readability of the Code

Improve Code reusability

Improve Code maintainability

Function: Function name cannot be defined repeatedly

To give a meaningful name to the function

Function feature: Only the call will execute

Format of function definition

Formal parameter list

return type function name (parameter type parameter name, parameter type parameter name,...)

{

Statement

....

return xxx;

}

How to define a function:

1, according to function functions to give a meaningful name to the function

2. Determine the value of some benefits that need not be descendants

3. Determine what type of data needs to be returned to the function caller

4. Complete function function

void when a function has no return value, declare the return value type of the function as void

When the return value type of the function is void, the return statement can be omitted

When do I need formal parameters: when we have a function, we can't be sure of the data, then we need to tell us.

C Language: Basic concepts of functions

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.