unsigned __int8 result[]= new unsigned __int8[sizeof(username) * 4];
智能感知:初始化與 '{...}' 預期聚合對象這裏有什麼問題
unsigned __int8 result[]= new unsigned __int8[sizeof(username) * 4];
智能感知:初始化與 '{...}' 預期聚合對象這裏有什麼問題
unsigned __int8 *result = new unsigned __int8[sizeof(username) * 4];
的類型是不一樣的;你不能用指針初始化數組。
new unsigned __int8[sizeof(username) * 4];
返回unsigned __int8*
,不unsigned __int8[]
改變你的代碼
unsigned __int8* result = new unsigned __int8[sizeof(username) * 4];
新返回一個指針,而不是一個數組。你應該聲明
unsigned __int8* result = ....
這裏,result是一個__int8的數組,所以你不能給整個數組賦值一個值。你真的想要:
unsigned __int8* p_result = new unsigned __int8[sizeof username * 4];
你有一個[C++書](http://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list)你從中學習? – GManNickG 2011-02-09 11:15:53
@GMan nope,加上如果我想返回結果怎麼辦? – TQCopier 2011-02-09 11:25:38