void dice(int count) {
int i;
if (n < count) {
print(n);
return;
}
for (i = arr[count - 1]; i <= 6; i++) {
arr[count] = i;
dice(count + 1);
}
}
This is.
Looking at this code, count
gave the parameter device(1)
in the main function.
What I don't understand from this code is that if i
is given as arr(count-1)
, does i
mean that i
increases the value by 1 from arr
0 and stores it? I don't understand
for (i = arr[count - 1]; i <= 6; i++) {
Assign the count-1
th element of arrr
to i
and increase i
by 1 from the next iteration until 7.
Additional questions are asked, so I am revising my answer:
I didn't understand. I don't quite understand that i initializes to arr[count-1] and increases i. When I do a for statement, I only see the form i=0 or i=num; or i=num-1. You initialize the value of i with an array, but you don't increase i and put it in an array. So when you initialize it with an array, does it mean that the value in i remains unchanged and only the repetition door rotates 6 times?
for (i = arr[count - 1]; i <= 6; i++) {
// a repeating sentence
}
int idx = arr[count - 1];
for (i = idx; i <= 6; i++) {
// a repeating sentence
}
The execution results of the above two codes are the same.
To initialize i
to arr[count-1]
literally allocates a value in the arr
array at arr-1
... This is.
Since there is an increasing or decreasing expression i++
, of course i
increases by 1 at the end of each loop.
891 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
573 Understanding How to Configure Google API Key
610 Uncaught (inpromise) Error on Electron: An object could not be cloned
577 PHP ssh2_scp_send fails to send files as intended
568 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
© 2024 OneMinuteCode. All rights reserved.