c - 结构设置和初始化变量
问题描述
我已经提供了代码段部分,设置了结构。设置结构时出现“预期表达式”错误。请参阅我提供的代码段。我已经查看了其他应该可以工作的代码。
Can not compile the program with the program segment below. Not sure how
to correct it. error in the .size and .char part. This part is just the
code segment for the structure.
#define MAX_SIZE 25 // max name size
typedef struct // structure for an employee name and height size
{
char name[MAX_SIZE];
int size;
} Employee;
int main(int argc, char ** argv)
{
Employee student = // initializes the structure
{
.name = { 0 }, // error expected an expression.
.size = MAX_SIZE // error expected an expression.
}; // does not accept the .name and .size
}
解决方案
我正在使用 Microsoft Visual Studio 2017。
推荐阅读
- javascript - 将 class= 属性添加到
- ios - 来自 Apple App Store Review 的 Symbolcate 崩溃报告
- azure - 如何将 docker hub 映像推送到现有的 Azure Web 应用程序?
- javascript - Javascript找到有条件的最大子数组
- javascript - 如何使反应选择不允许选项中的空间?
- apache-spark-sql - 有没有办法知道 S3 表中写入的最后一个分区是什么,用于 AWS Glue 作业中的下推谓词?
- javascript - 不能再从本地主机上传图片到 imgur
- javascript - 中断 D3 过渡:如何在拖动时中断正在进行的过渡?
- javascript - 在 d3 div 中放置两个以上的值
- python - Python DataFrame - 为具有分组列(至少两列)的数据框绘制条形图