Home > Back-end >  C language scheduling problems
C language scheduling problems

Time:10-13

C language subject is ascending, black is the answer, on the left to the right is my written according to the teacher speak, both the running result of the same, I don't know which one to use? Don't understand what meaning is on the left side of the black code, can you tell me about your, as well as the right red circle, both num and num - 1 the results did not affect the is why?

CodePudding user response:

With black, black conforms to the human thinking habits,
Is to take out the first, and then the second than
Take the first n and n + 1

CodePudding user response:

Suggestions on the compiler to write more and test,

CodePudding user response:

Array subscript starting from 0, sometimes for loop subscript problems should be paid more attention to, if you just open the num, then from 0 to (num - 1), if the num, an array, the result will not change, but you have OJ will burst, so commonly used in open array target number + 1, then starting from 1
  • Related