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) This class of learning array, a most basic type of construction, it is a set of the same type of data ordered collection.

(2) The elements in the array are kept in memory, each element belongs to the same data type, and the array elements can be uniquely determined with array names and subscripts.
(3) Definition and reference of a one-dimensional array: Defines an array that requires explicit array variable names, the type of array elements, and the size of the arrays.

The general form of a one-dimensional array definition is: Type an array group name [array length];

(4) The type name specifies the type of each element in the array, the array name is the name of the array variable, is a valid identifier, and the array length is an integer constant expression that sets the size of the array. The array length is a constant.

Array subscript starting from 0, subscript cannot be crossed.

The array name is an address constant that holds the first address of the array memory space.

(5) Initialization of one-dimensional arrays: As with the initialization of simple variables, when you define an array, you can also assign an initial value to a group element.

The general form is: Type an array group name [array length]=[initial value table];

2. Problems encountered during the experiment and solutions:

(1) Understanding ability is not very good, sometimes can not be immediately clear test instructions;

(2) The definition of an array and the reference of a numeric element are sometimes mistaken;

(3) The topic reads several times, asks schoolmate, reads a book;

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

This chapter learned the concept of the array, let the program run up to a new difficulty, overall this chapter only let me not white a place is superscript and subscript problem later went to Baidu asked to thoroughly understand, in short, the appearance of the array makes C language can run non-basic data types of programs, expand the scope of application of C language.

4. Preview:

(1) The definition of a two-dimensional array:

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

Example: int a [3] [2]; /* Define a two-dimensional array a,3 row 2 columns with a total of 6 elements. */

(2) An element referencing a two-stack array is assigned two subscripts in the form:

Array name [row subscript] [column subscript]

The reasonable value range of row subscript [0, line length-1];

(3) 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}, ...} ;

(4) The order of the initial value of the general form:

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

(5) The corresponding relationship between the term of the Matrix and the subscript of the two-dimensional array;

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.