我正在開發一個項目,並試圖將一個結構傳遞給一個函數,我嘗試了各種方法,但即時通訊仍然很短。我得到錯誤信息:將結構傳遞給Visual Studio中的函數
非法使用這種類型的表達式。
真的很感謝你的幫助。
#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);
}
'void main'是未定義的行爲。 – chris 2013-03-04 02:10:00