c - 您如何使用用户关键字“列表”?
问题描述
对于我正在从事的实际工作,我必须为某些功能使用“预设”结构。其中之一如下:
int initEmployees(Employee* list, int len)
{
//From here is my code
int isError = -1;
if ( len > 0)
{
len--;
for (int i = 0 ; i < len ; i++)
{
//This line is the problem, I know is not right but not sure how to fix it
list[i].isEmpty = 1;
/*My other guesses where:
*(list + i).isEmpty = 1;
(*Employee + i).isEmpty = 1;
but im quiet sure they won't work either*/
}
isError=0;
}
return isError;
}
尝试谷歌搜索:“代码块用户关键字是否与 STL 相关!” 并通过一本 1991 年的 C 书(西班牙语编辑)检查它是否继续引用任何包含它但没有的库。
解决方案
list
不是 C 中的关键字。
推荐阅读
- java - 为什么我的底部导航栏不能显示?
- javascript - 将空数组作为第二个参数传递时,React Hook useEffect 缺少依赖项
- android - Flutter 升级到 v1.14.7-pre.83 并迁移到 AndroidX 后只显示白屏
- java - 将字符串从数组列表转换为另一个字符串
- flutter - 文本小部件正在剪裁(颤振)
- c++ - Windows C++:如何定义 WINAPI 类型的回调成员函数?
- php - 获得高流量时将 index.php 重定向到 index2.php 的最佳方法是什么?
- vue.js - 依赖于另一个计算属性的计算属性
- amazon-web-services - AWS EC-2 检查域是否与公共 IP 地址正确链接
- python - 如何仅从python的开头和结尾删除引号