//definition of two vectorsvector<int> fib = {1,2,3}; vector<int> Lucas = {2,4,6};//Array pointer: Pointer to arrayvector<int>* PV =nullptr; PV = &fib;//See if the array pointer is work. The vector is accessed first, and then the elements of the vector are accessed by []. cout << (*PV) [0] << Endl;//array of pointers: an array with pointers. The type of the element in the previous specified vector, followed by [] indicates that this is an arrayvector<int>* seq_add[2] = {&fib, &lucas};//Can be seen from above. The important difference between pointer numbers and array pointers is whether they have parentheses. //This has been a headache for beginners. //access to array pointers first. The first [0] represents the first element that accesses an array pointer, which is an address. Get a vector, //The second [0] represents the first element that accesses the fib. cout << (*seq_add) [0][0] << Endl;
An analysis of array pointers and arrays of pointers. Beginners can also read (after all, the rookie wrote)