Home > Back-end >  Please answer
Please answer

Time:06-09

Directly define int x=0; And what is the difference between defined in circulation x=0

CodePudding user response:

In general, effective, in the area of the definitions of the so-called scopes, and variables defined within a loop, equivalent to the inside of the block, applies only to the current block

CodePudding user response:

Definition in the outside, he is just the first cycle when the initial value of x is zero
Internal definition, that is, each cycle, its initial value is zero

CodePudding user response:

VS have a more wonderful work, however, is that in the for variables defined inside, outside is still valid, so, if two for define the variables with the same name is not allowed inside, generally the best move to the front to define

CodePudding user response:


I hope it can help you: https://blog.csdn.net/it_xiangqiang/category_10581430.html
I hope it can help you: https://blog.csdn.net/it_xiangqiang/category_10768339.html
  • Related