+ 1
Why in most of programming languages declaration statement is done in the beginning of program?
Principal of programming languages
4 Respuestas
+ 8
Well, we obviously don't do them at the end of the program, since constructs are declared before use and not after use. It is also a good practice to group declarations together so that you don't have to go all over your code to search for a missing declaration later on.
+ 3
You can declare them at time of use, but that gets messy really fast. Its important to keep your code tidy and structured and easy to read otherwise the bigger it gets, the more time you’re going to waste looking for variables scattered throughout your code rather than a nice organized list of them in a certain location. As Hatsy said, it is good practice.
0
But we can also declare variable at time of it's use.like in c++