int t, i;
t = 0;
for (i = 0; i < 10; i++) {
t++;
}
printf("%d %d\n", t,i);
int a, i, j;
for (i = 0; i < 10; i++)
for (j = 0; j < 5; j++)
a = i +j;
printf("%d", a);
What's the difference? I'd appreciate it if you could explain in detail why the first one is 1010. The second one is i is 9 and j is 4, so it's 13 right?
c
A for repeat statement consists of for(initialization; condition; operation) { code to be repeated; } After performing the code in the for statement, perform a operation and check if it meets the condition.
So the first code is that the value of the variable i increases from 0 to 10, and then the condition is checked and the for statement ends, and the value of i is output to 10.
The second code continues to assign a value to variable a within the for statement, and the last action is if the value of i is 9, and the value of j is 4. The value of a becomes 13 because the repeat statement ends with 13 assigned as a value of a.
549 PHP ssh2_scp_send fails to send files as intended
542 Unable to install versioned in Google Colab
532 Uncaught (inpromise) Error on Electron: An object could not be cloned
702 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
547 Who developed the "avformat-59.dll" that comes with FFmpeg?
© 2024 OneMinuteCode. All rights reserved.