Variable Sized Arrays

  • + 1 comment

    Why you don't take the int k & int data out of the for loop?

    • + 0 comments

      Yes, you can take 'int k' and 'int data' out of the for loops and declare them outside. This is for scoping purpose (that is, to be 'defensive' in programming). This is just in case there is a 'k' somewhere else in the code too. The 'k' or 'data' inside the for loops will be different from those elsewhere.