Is this correct / legal C99, and will it do what I expect?
Code:
void AFunction(void) {
WORD * kludge = NULL;
// ...
if (topLeft) {
kludge = (WORD []) { 0, 1 };
}
// ....
DoSomethingWith(kludge);
}
i.e. is the WORD [] containing the values 0 and 1 available outside of the scope of the if statement that it is declared in? Is it really allocated in the stack frame for the function, or does it end disappearing when the if statement completes, leaving kludge pointing to potential garbage?