Experiment 10--definition and reference of one-dimensional arrays

Source: Internet
Author: User
Tags array definition

1. The knowledge points learned in this lesson:

(1) The general form of a one-dimensional array definition:

Type an array group name [array length];

The type name specifies the type of each element in the array; the array is the name of the array variable, and the array length is a constant; the array name is an address constant that holds the first address of the array memory space.

(2) The reference form of an array element:

Array name [subscript]

The subscript can be an integer expression, and the reasonable range is [0, array length-1] cannot be crossed.

(3) The representation of one-dimensional array initialization:

Type an array group name [array length]=[initial value table];

C language can only initialize static storage arrays, static storage array If there is no initial value, the system will automatically assign a value of 0 to all array elements.

(4) subscript can be used as a cyclic variable, and all elements of the array can be processed one by one.

(5) Select Sort method

2. Problems encountered during the experiment and solutions:

(1) The program flow of the algorithm is not particularly clear.

(2) Read more and practise more.

3. Experience of experiment and summary of the study in this chapter:

(1) Experience: In the recent practice, increased their understanding of the topic and thinking, no longer as the same as before the control of the book imitation. Whenever a new topic is made, it is still quite fulfilling (~ ̄▽ ̄) ~

(2) Learning Summary: This chapter has learned one of the most basic types of construction-arrays, which are an orderly combination of data of the same type. The elements in the array are kept in memory, each element is of the same data type, and array elements can be uniquely determined with array names and subscripts. This is different from the previous new content, more need to pay 100% of the effort to learn.

4. Preview:

Two-dimensional arrays:

(1) Two-dimensional array definition form:

Type an array group name [line length] [column length];

(2) A reference to a two-dimensional array should refer to two subscripts in the form:

Array name [row subscript] [column subscript]

Row subscript Reasonable range [0, line length-1], column subscript reasonable range [0, column length-1]

(3) Two-dimensional array initialization

Method One: The branch assigns the initial value general form:

Type an array group name [line length] [column length]={{initial value table 0},...,{initial value table K}, ...};

Method Two: The order assigns the initial value general form:

Type an array group name [line length] [column length]={initial table};

Experiment 10--definition and reference of one-dimensional arrays

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.