While coding in C, I came across the below situation.
int function () { if (!somecondition) return false; internalStructure *str1; internalStructure *str
It ultimately depends on the compiler but usually all locals are allocated at the beginning of the function.
However, the cost of allocating local variables is very small as they are put on the stack (or are put in a register after optimization).