Relationship between pointer and lower mark

Source: Internet
Author: User
The name of a one-dimensional array is a pointer constant. It stores the address of the first element of a one-dimensional array.

# Include <stdio. h> int main (void) {int A [5]; // A is the array name. 5 is the number of array elements. The element is the variable A [0] -- A [4] // int A [3] [4]; // three rows and four columns A [0] [0] are the first element a [I] [J], row I + 1 J + column 1 int B [5]; // A = B; // error A is a constant printf ("% # x \ n", & A [0]); printf ("% # x \ n ", a); Return 0;}/* the output result in VC ++ 6.0 is: ---------------- 0x12ff6c0x12ff6cpress any key to continue ------------. Conclusion: one-dimensional array name one-dimensional array name is a pointer constant which stores the address of the first element of one-dimensional array */

 

Relationship between pointer and lower mark

# include <stdio.h>int main(void){    int a[5] = {1,2,3,4,5};    int i;    for (i=0; i<5; ++i)        printf("%d\n", a[i]);  //a[i] == *(a+i)     return 0;}

 

 

Demo2.

# include <stdio.h>int main(void){    int a[5] = { 1,2,3,4,5};    for( int i = 0 ; i < 5 ; i++ ){        printf("%d \n" , a[i]);    }    for(i = 0 ; i < 5 ; i++ ){        printf("%d \n" , *(a+i));    }return 0 ;}

 

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.