C an array of base--c languages

Source: Internet
Author: User

Definition of the array:

First, the correct wording:

1.int ages[5]--defines an array of 5-length int types

2.int ages[]={1,2,3,4,5};--defines an array of type int of 5 length, and initializes the value of the array

3.int ages[5]={10};--defines an array of type int of 5 length, and gives ages[0]=10;

Second, the wrong wording:

1.int a[]; 2.int[5] A--c#,java The method of defining an array in the language, be sure to differentiate it from the C language!

2.int a[] = {10,12,13}; The name of the a={11,15,16};--array represents the address of the array in memory and can be considered a constant

Three, array and function, involved in the pointer, later detailed description

1#include <stdio.h>2 voidChangeint);3 voidChange2 (int []);4 5 intMain ()6 {7     intages[Ten] = {Ten, One, -, the, -};8     9     //printf ("Number of bytes occupied by the array:%ld\n", sizeof (Ages));Ten      One     //Change (ages[1]); A      - Change2 (ages); -      theprintf"ages[1]=%d\n", ages[1]); -      -     return 0; - } +  - //When an array is a function parameter, the number of array elements can be omitted + //When an array is a function parameter, the pass is the address of the array, and the array and ages share a piece of storage space A //always 8 (64bit) when calculating the number of bytes in a parameter group within a function at //since the system will be a parameter group to a pointer type, the pointer type will always be 8 bytes - voidChange2 (intarray[]) - { -printf"number of bytes occupied by the array:%ld\n",sizeof(array)); -      -      inarray[1] = -; - } to  + //when a basic data type is a function parameter, only the value is passed - //Modifying the parameters inside the function does not affect the outside arguments the voidChangeinta) * { $A =Ten;Panax Notoginseng}

C an array of base--c languages

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.