getmaxyx 如何改变传递变量的值?
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;
}
结果是
宽度:148
身高:38
如何在不传递指针的情况下更改宽度和高度
如果你阅读 https://linux.die.net/man/3/getmaxyx 你会看到:
Notes All of these interfaces are macros. A "&" is not necessary
before the variables y and x.
getmaxyx 是一个宏
#define getmaxyx(win,y,x) (y = getmaxy(win), x = getmaxx(win))
#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
如何在不传递指针的情况下更改宽度和高度
如果你阅读 https://linux.die.net/man/3/getmaxyx 你会看到:
Notes All of these interfaces are macros. A "&" is not necessary before the variables y and x.
getmaxyx 是一个宏
#define getmaxyx(win,y,x) (y = getmaxy(win), x = getmaxx(win))