我正在做一个项目,我试图将一个结构传递给一个函数,我尝试了各种方法,但我仍然做不到。我收到错误消息:
非法使用这种类型的表达。
非常感谢您的帮助。
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
struct big{
int day;
int year;
char month[10];
} ;
void gen(struct big);
void main()
{
int choice;
printf("\t\t\t\t\t*MENU*\n\n\n");
printf("\t\tGenerate Buying/Selling Price-------------------PRESS 1\n\n");
printf("\t\tDisplay Foreign Exchange Summary----------------PRESS 2\n\n");
printf("\t\tBuy Foreign Exchange----------------------------PRESS 3\n\n");
printf("\t\tSell Foreign Exchange---------------------------PRESS 4\n\n");
printf("\t\tExit--------------------------------------------PRESS 5\n\n\n\n");
printf("\t\tPlease enter your choice");
scanf("%d", &choice);
if (choice == 1)
{
gen(big);
}
system("pause");
}
void gen(big rec)
{
printf("Enter the date in the format: 01-Jan-1993");
scanf("%d %s %d", &rec.day, &rec.month, &rec.year);
}