Wednesday, 15 July 2015

c++ - Which is the proper style? -


Announce all the variables at the beginning of the code or declare it before using, which is considered a good practice? Like

  int main () {int x, y, z, a, b, c; .....}   

or

  int main () {int x; // .... int y, z; // ...... int a, b, c; //, ....}    

I like to make all announcements Above all, With a comment, it allows me to always go to one place. OTOH (on the other side) if I be local to variables in some areas (such as i for loop variables) I want to break that rule.

No comments:

Post a Comment