Quote:Original post by Antheus
Note that Pascal and C were designed around 1978 with strong influence from Algol.
Note that C was in production use by 1970. It was used to port the Unix operating system to new hardware that year.
Also, note that FORTRAN, in first production use in 1952, allowed variable to be declared at first use anywhere in the body of code, just like with C++ (FORTRAN did not, in fact, allow you to declare variables separately from first use until, what, Fortran 77?). The enforced placement at the top of a function definition was never due to the restructions of running on slow processors with little memory. It was purely due to theoretical reasons about how to write programs better.
As Antheus said, it was the heritage of Algol. Algol was designed by a committee of academics who knew far more about how to write good software than the folks on the ground who actually wrote and maintauned that stuff. Those folks mostly used COBOL wherein you declared all your variables separately in the Data Division and used them later in the Procedure Division. We all know Algol caught on like wildfire and replaced COBOL.