Quantcast
Viewing all articles
Browse latest Browse all 223

Comment by Peter - Reinstate Monica on Redeclaring variables in C

You write/declare it once in the static C code; but at runtime, its declaration is passed and its initialization is performed many times. All modern mainstream compilers would pull that constant declaration out of the loop (and as soon as the most modest optimization is enabled, eliminate all of y from the code); but conceptually, y's scope is left with each iteration, and y is initialized over and over again each time the control flow passes the declaration.

Viewing all articles
Browse latest Browse all 223

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>