How to create array of pointers in C++

1 Answer

0 votes
#include <iostream>

int main() {
    int *arr[5];

    for(auto &addr : arr) {
        std::cout << &addr << "\n";
    }
}




/*
run:

0x7ffc62490fc0
0x7ffc62490fc8
0x7ffc62490fd0
0x7ffc62490fd8
0x7ffc62490fe0

*/

 



answered May 13, 2021 by avibootz
edited May 13, 2021 by avibootz

Related questions

...