pointer reference type
- by Codenotguru
I am trying to write a function that takes a pointer argument, modifies what the pointer points to, and then returns the destination of the pointer as a reference.
I am gettin the following error: cannot convert int***' toint*' in return|
Code:
#include <iostream>
using namespace std;
int* increment(int** i) { i++; return &i;}
int main() {
int a=24;
int *p=&a;
int *p2;
p2=increment(&p);
cout<<p2;
}
Thanks for helping!