If you want to know why your first idea compiled but didn't seem to work:
When you omit braces in an if-statement:
if ((n % 2) != 0) int farray[halfelements + 1];
it's just the same as if you'd used them:
if ((n % 2) != 0) {
int farray[halfelements + 1];
}
So it is making an 'farray' of the correct size -- and then it immediately goes out of scope and is gone, and you're left with only the original one.