開發平台(Platform): (Ex: Win10, Linux, ...)
QT 5.10
編譯器(Ex: GCC, clang, VC++...)+目標環境(跟開發平台不同的話需列出)
qt creator4.5.1
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
問題(Question):
short tempData[10];
*(int *)tempData = 1;
*(double *)&tempData[1]=100;
qDebug() << " " << tempData[0];
qDebug() << " " << tempData[1];
請問為什麼 轉int結果是對的
但是double 卻是0呢
c++新手 求各位幫幫我 感謝
其中qDebug 相當於 cout
預期的正確結果(Expected Output):
1
100
錯誤結果(Wrong Output):
1
0