对 NULL 值的按位运算能否使 C++ 中的代码崩溃

Can Bitwise Operation on NULL value crash the code in C++

似乎我的程序在这一行崩溃了,我对 "a" 填充了 NULL 值的数组(空数组)进行了一些按位运算,这会导致程序崩溃吗?

const unsigned char a [ something ];
int b;
b = (a[0] & 0x0f) << 8; 

没有,下面的代码

const unsigned char a [ something ];
int b;
b = (a[0] & 0x0f) << 8; 

本身 不会导致您的程序崩溃。您的代码还有其他问题。