我的下面的代码有什么错误?。我在编译时遇到错误。 [英] What is the error in my below code?.I'm getting error on compilation.
本文介绍了我的下面的代码有什么错误?。我在编译时遇到错误。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
#include <stdio.h>
#include <string.h>
typedef struct
{
int id;
char name[30];
float percentage;
}status, *var1;
int main()
{
status data;
var1=&data;
strcpy(var1->name,"HelloWorld");
var1->id=100;
var1->percentage=200;
printf("\nEmployee Name : %s\n", var1->name);
printf("\nEmployee ID : %d\n", var1->id);
printf("\nEmployee percentage : %f\n", var1->percentage);
return 0;
}
[edit]已添加代码块 - OriginalGriff [/ edit]
[edit]Code block added - OriginalGriff[/edit]
推荐答案
如果你告诉我们错误信息会有帮助!但是......
改变这个:
It helps if you tell us the error message! But...
Change this:
typedef struct
{
int id;
char name[30];
float percentage;
}status, *var1;
对此:
To this:
typedef struct
{
int id;
char name[30];
float percentage;
}status;
status *var1;
这篇关于我的下面的代码有什么错误?。我在编译时遇到错误。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文