Although there could be a very simple answer to this question - That's how languages are designed.
But I recently started coding in C++. My main language is Java. And I found it really weird.
Like things like you need to have a function declared on top to use it. A function name and variable name cannot be same. These are like entirely different from Java.
But being a language for so long C++ and having this restriction of declaring function signature on top seems little unnatural in the sense they could have easily removed this one. But probably the design of the language doesn't allow now.
Just put my thoughts above. Wanted expert views and comments for a discussion.