"C Language" basis (V) array

Source: Internet
Author: User

Array (c language):
1, set;
2, the orderly collection;
3. Same data type

Type specifier array name [constant expression (length)] (C language does not support dynamic length)
(Can be either a basic data type or a constructed data type)
const int A; const constant, readable only

Initialization
int a[5]={0,0,0,0,0};
a[5]={1,2};
={};
Cannot empty one or more element assignments (can be less than empty)

Assigning a value using a circular method


A special array
Char str[20] = {' A ', ' B ', ' C '};
= "Hello World";(consecutive characters)

The form of initialization
A[10] = {1,2,3,4}; You can only use curly braces to assign values at the time of definition initialization

STR[20] = "Hello";


Accessing array elements
Subscript method to access the 0~length-1
B[1]//second element

Bubble sort
Double loop
Outer loop indicates sort count
Inner Loop Two adjacent elements comparison

"C Language" basis (V) array

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.