Fix compile error: cannot declare variable in the middle of a function in pure C