I found this code , when I compile it , the compiler tell me "subscripted value is neither array nor pointer" . I know my platform is old . but I want know that "unsigned int bValue = {0}" is a new way to init array ?
unsigned int bValue = {0};
uBlockSize = sizeof(bValue) / sizeof(unsigned int);
for (i = 0; i < uBlockSize; i++)
bValue[i] = ui8Value << 24U |
ui8Value << 16U |
ui8Value << 8U |
ui8Value;
I want know that "unsigned int bValue = {0}" is a new way to init array ?
The code doesn't compile (I tested the latest versions of clang, gcc and MSVC) because
bValue[i]is not applicable to a scalar.bValuedoesn't appear to be an array (maybe the original code looks different?); therefore, any attempt at indexing will result in compilation error.As correctly pointed out by @nielsen, the initialization in itself is correct, although it's more often seen applied to arrays.