Home > Back-end >  Questions about the array
Questions about the array

Time:09-27

CodePudding user response:

Nums [3]=temp; Why is 0 to 1 bit will be 1
Nums=nums [I] [I - 2); Why is crossing the line, the first output rather than the other 16 Numbers

CodePudding user response:

Best post code

CodePudding user response:

You also know is crossing the line

Why is 16 17 as this is a question of excess output ask why 17
Why didn't it is not necessary to discuss
Don't cross this weren't broken

CodePudding user response:

1. The nums [3]=temp; Why is 0 to 1 bit will be 1
Look from the program, the program in the array data shift, not the nums [0] for assignment operation, so the nums [0] before the data is still input value 1

2. The nums=[I] nums [I - 2); Access to an array of crossing the line
The for loop I==1, nums [2] I - & gt;> Access to cross-border nums [1], a memory access to the front of the nums array, this paragraph of memory data is uncertain, May 16, may also be other values, you change the time to run, or do other operations and run out of data may be different,
You can debug a look at the data memory, or to define a pointer, pointing to the nums array before an address (int), was clear to obtain the data about the memory address

PS: must be paying close attention to the array access to cross-border problems, be sure to avoid, in order to avoid unnecessary mistakes, array subscript take more methods to access: an array of values under the [%] array length
  • Related