首页 > 解决方案 > 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;
}

结果是
宽度:148
高度:38

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

标签: cncurses

解决方案


如果你阅读https://linux.die.net/man/3/getmaxyx你会看到:

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


推荐阅读