views:

32

answers:

1

So I have these lines of code:

int maxY, maxX;
getmaxyx(stdscr, &maxY, &maxX);

It gives me the following error:

error C2440: '=' : cannot convert from 'int' to 'int *'
        Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast

twice for each time I use it. I'm not even using the = operator! The curses.h file is included. What am I doing wrong?

+4  A: 

getmaxyx is a macro, which doesn't take int*, but int.
It resolves to something like

getmaxyx(S,Y,X) -> X=s->X, Y=s->Y

try

getmaxyx(stdscr, maxY, maxX); // without the & operator

see http://opengroup.org/onlinepubs/007908775/xcurses/getmaxyx.html

Yossarian
Thanks! I love the fast response I got.
flarn2006