getmaxyx如何更改已传递变量的值? #包括 #包括 int main(){ initscr(); int高度、宽度; getmaxyx(stdscr、高度、宽度); endwin(); printf(“宽度:%i\n”,宽度); printf(“高度:%i\n”,高度); 返回0; }

getmaxyx如何更改已传递变量的值? #包括 #包括 int main(){ initscr(); int高度、宽度; getmaxyx(stdscr、高度、宽度); endwin(); printf(“宽度:%i\n”,宽度); printf(“高度:%i\n”,高度); 返回0; },c,ncurses,C,Ncurses,结果是 宽度:148 身高:38 如何在不传递指针的情况下更改宽度和高度如果您阅读,您将看到: 注意:所有这些接口都是宏。不需要“&” 在变量y和x之前 getmaxyx是一个宏 #include <stdio.h> #include <ncurses.h> int main() { initscr(); int height, width; getmaxyx(stdscr, height, width); endwin(); printf(

结果是
宽度:148
身高:38

如何在不传递指针的情况下更改宽度和高度

如果您阅读,您将看到:

注意:所有这些接口都是宏。不需要“&” 在变量y和x之前


getmaxyx是一个宏

#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;
}

因为它是一个宏,而不是一个函数。理论上,这是一个问答网站。社区将决定这是否是一个值得为他人服务的答案。@ayoubkafi好吧,我对问题和答案进行了投票,因为这是第一次在堆栈溢出(search
getmaxyx macro
)上提出这一问题。
#define getmaxyx(win,y,x) (y = getmaxy(win), x = getmaxx(win))