C language 6

Source: Internet
Author: User

// When an array is used as a parameter, you can pass in the array name by calling the function.


# Import "function. H"
Int Var = 10; // global variable, which can be accessed in all functions. The space is not recycled during the program running.


// Variable x y is a variable defined within the function. It can only be valid within the function and cannot be accessed outside the function. Therefore, it is called a local variable. (when a function is called, open up space for variables. When the function ends, reclaim the space .)

Int maxvalue (int x, int y)


// The variable modified by static is a static variable,
// Features: 1. the space value is opened once, and the space is not recycled during the program running.
// 2. The variable is initialized only once.
// 3. If no initial value is assigned, the default value is 0.
Static int sum = 0;

// A function is used to implement a separate function. Only Code related to the function is written in the function.
// Function usage:
// 1, function declaration; written in. h file
// 2. Define the function. (implementation of the function), which is written in the. M file.
// 3. Call the function. (implement the call in the main function in the main. M file)

/A [] used to accept the array count used to accept the number of array elements
Void outputarr (int A [], int count );

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.