Been trying to get this to work for hours with many different methods but still can't get it to work...
Main class:
WinHandle wh;
int* myarr;
myarr = wh.getpos;
cout << "left: " << *(myarr) << endl;
WinHandle.cpp class:
int* WinHandle::getpos(){
int pos[4];
//code
pos[0] = 2;
//code
return pos;
}
WinHandle.h file:
int* getpos();
That's just my last method, tried various others to no avail. Any help?
Keep getting
non-standard syntax; use '&' to create a pointer to member
and
cannot convert from 'int *(__thiscall WinHandle::* )(void)' to 'int *'
myarr = wh.getpos();. 2. You're trying to return a pointer to local variable so it will become dangled (didn't you get any compile warnings?).std::array, orstd::vector, or one of other beautiful containers.