获取指针而不是指针的值

#include <iostream>
#include <vector>
using namespace std;
 
std::vector<int*> vector1;

void getNumber(int * &par)
{
   // 获取某个值
   par = vector1[2];
   return;
}
 
int main ()
{
   int a = 1;
   int b = 2;
   int c = 3;

   vector1.push_back(&a);
   vector1.push_back(&b);
   vector1.push_back(&c);

   int * goal;
   getNumber( goal );
 
   // 输出实际值
   cout << "Number of :" << *goal << endl;
 
   return 0;
}

C++ 从函数参数中获取指针 指针传递_ios