我有代碼:爲什麼我的代碼給出「結構返回值與函數類型不匹配」編譯錯誤?
typedef struct t
{
uint8 a[100];
}t;
t tt; //object of the struct
f(&tt); //some file calling the func
//function body in some file
uint8 *f(const struct t *ptr)
{
return ptr->a;
}
當我嘗試建立我的錯誤:
Return value type does not match the function type.
我缺少的東西?
你肯定包含包含函數原型的頭文件和看得見的每一個翻譯單元? –
試'的typedef struct' - >'typedef結構t' – BLUEPIXY
我會懷疑'const'造成麻煩。錯誤消息是否顯示更多細節? – Gerhardh