Pointer array and array pointer, pointer array pointer

Source: Internet
Author: User

Pointer array and array pointer, pointer array pointer

# Include <iostream> int main (int argc, char ** argv) {char * s [10]; // pointer array char (* s1) [10]; // array pointer // the first one is a pointer array, that is, the pointer is an adjective used to modify the array. it is visible and the focus falls on it. This is an array. // What are the elements of the array? Yes pointer to the character array pointer. // there are 10 elements in the pointer array. // So char SC [2]; s [0] = SC; // or the following method is also true. Char ss [] = {"hello"}; s [1] = ss; printf (ss); // For array pointers, an array is an adjective that focuses on it as a pointer. // Is a pointer to the character array. The length of this character array must be 10 // that is, char myString [10]; s1 = & myString; return 0 ;}

Running result:

 

Related Article

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.