実験

deleteとdelete[ ]の違い

下記のコードにCPPCHECKを実施すると『Mismatching allocation and deallocation』というエラーを出力する。WarningではなくErrorなので重い。 void main(void) { float *sn = new float[100]; delete sn; return; }snはfloat型の配列なのでdelete[]とすれば…

BYTE型にint型を代入

x86系CPU(リトルエンディアン)では、下のBYTE型変数test(unsigned char)に0x12345678という整数値を代入した場合、testにはいくつが代入されるか? #include <windwos.h> int main(void){ BYTE test; test = 0x12345678; return 0; } A. 0x78 (120)</windwos.h>