Search code examples
cncurses

How does getmaxyx change the value of a passed variable?


#include <stdio.h>
#include <ncurses.h>

int main() {

  initscr();

  int height, width;
  getmaxyx(stdscr, height, width);

  endwin();

  printf("width  : %i\n", width);
  printf("height : %i\n", height);

  return 0;
}

result is
width : 148
height : 38

How the width and height were changed without passing a pointer


Solution

  • getmaxyx is a macro

    #define getmaxyx(win,y,x) (y = getmaxy(win), x = getmaxx(win))