I have the following code snippet:
int i[] = {42, i[0]};
Is such initialization allowed or leads to undefined behaviour?
Three major compilers (gcc, clang, msvc) give me 42 for i[1]. Hence looks legit, but I would like to see a cite from the standard for this case.
int i[] = { [1] = func(i[0]), [0] = 5 };you could also initialize the whole array using a single value 42Would you mind to show how?