我一直絞盡腦汁在這一段時間,我只是想創建,我想返回兩個int的返回一個結構的方法。聲明的類型「結構」的原型 - Visual C
我的原型爲方法如下:
typedef struct RollDice();
而且該方法本身:
typedef struct RollDice()
{
diceData diceRoll;
diceRoll.dice1 = 0;
diceRoll.dice2 = 0;
return diceRoll;
}
編譯器顯示了錯誤:"Syntax error: ')'"
兩者的原型和實際方法。
的結構本身:
typedef struct
{
int dice1;
int dice2;
}diceData;
是很明顯我要去哪裏錯了嗎?我試過了我能想到的一切。
感謝
編輯/解決方案:
爲了讓節目與建議的解決方案,我不得不做出以下更改結構工作,
typedef struct diceData
{
int dice1;
int dice2;
};
不客氣。 – 2010-03-23 16:24:37