pointer reference type
Posted
by Codenotguru
on Stack Overflow
See other posts from Stack Overflow
or by Codenotguru
Published on 2010-04-27T00:54:27Z
Indexed on
2010/04/27
1:03 UTC
Read the original article
Hit count: 440
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***' to
int*' 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!
© Stack Overflow or respective owner