C + + Note the Fetch address character after the array!!

Source: Internet
Author: User

#include <iostream>#defineMin (a, B) (a>b?b:a)using namespacestd;intmain () {inta[5]={1,2,3,4,5};int*p= (int*) (&a+1);//the array name itself is the address, that is, the array name is the pointer,> the address of the array, that is, the address of the pointer, that is, p is a pointer to the array (pointer pointer), when the &a+1,p point is actually the end of the array after 5 address, when p-1, back to the end of the array ,> is 5.     int*p1; P1=a+1; cout<<* (p-2) <<endl; cout<<*p1<<endl;}

C + + Note the Fetch address character after the 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.