[問題] 用keil C 一個更動全域結構的函數編不過去...
開發平台(Platform): KEIL C (寫8051程式的)
問題(Question):一個改變全域結構的函數無法編譯
餵入的資料(Input):
struct Helth
{
char LV;
char MaxHP;
char MaxMP;
char Atk;
char Def;
char HP;
char MP;
int UpLVEXP;
int EXP;
}; /*以上為在main外宣告的陣列
void UpLV(int NewLV)
{
int i;
Helth.LV =NewLV;
Helth.Atk =NewLV*10;
Helth.Def =NewLV*10;
Helth.MaxHP =NewLV*20;
Helth.MaxMP =NewLV*20;
.............................(這是要改變結構數值的函數)
預期的正確結果(Expected Output):
編譯產生執行檔
錯誤結果(Wrong Output):
error C202: 'Helth': undefined identifier
error C202: 'Helth': undefined identifier
error C202: 'Helth': undefined identifier
error C202: 'Helth': undefined identifier
error C202: 'Helth': undefined identifier
Target not created
/*行數顯示是在函數內出錯
我想知道我到底錯在哪裡.....
程式碼(Code):(請善用置底文網頁, 記得排版)
補充說明(Supplement):
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.115.236.24
→
03/25 14:57, , 1F
03/25 14:57, 1F
→
03/25 15:01, , 2F
03/25 15:01, 2F
→
03/25 15:03, , 3F
03/25 15:03, 3F
推
03/25 15:05, , 4F
03/25 15:05, 4F
→
03/25 15:05, , 5F
03/25 15:05, 5F
→
03/25 15:07, , 6F
03/25 15:07, 6F
→
03/25 15:07, , 7F
03/25 15:07, 7F
→
03/25 15:12, , 8F
03/25 15:12, 8F
推
03/25 15:14, , 9F
03/25 15:14, 9F
→
03/25 15:14, , 10F
03/25 15:14, 10F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章