c - 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
如何在不传递指针的情况下更改宽度和高度
解决方案
如果你阅读https://linux.die.net/man/3/getmaxyx你会看到:
注意 所有这些接口都是宏。在变量 y 和 x 之前不需要“&”。
推荐阅读
- html - 在占位符文本之前使用图标搜索输入 - Material Design
- css - 导航栏 - 透明问题
- c# - 在 C# 类中模拟 WCF 行为以在方法调用之前运行触发器
- apache-spark - spark - 在工作人员完成处理分区后执行挂钩的任何方式?
- google-chrome-extension - Chrome 扩展程序阻止对 popup.html 的编程请求
- reactjs - 在 ReactJS 中试图获取参数,但我得到属性 'id' 在类型'{}' 上不存在
- xml - xml 中的非法字符“0xa0”
- r - 如何从 R 中的单个记录中绘制运行累积总计?
- angular - 如何在 PrimeNG 自动完成文本框的“onBlur”事件中将值传递给我的组件?
- rxjs - 缓存来自 BehaviorSubject 的管道结果