What value should I put in the for loop for incrementing? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What value should I put in the for loop for incrementing?

int arr[8]; for(int x = 0;x<=?;x++) { } what value to put in the question mark?

25th Jul 2016, 5:51 AM
Omar
Omar - avatar
7 Answers
+ 3
7 because the array has a size of 8 and your starts numbering the variables at 0
25th Jul 2016, 7:30 PM
Rick Wouters
Rick Wouters - avatar
+ 1
7
25th Jul 2016, 12:51 PM
Subramanian Thiagarajan
Subramanian Thiagarajan - avatar
+ 1
7 ( the x value starts from 0 ,and the compiler increments this 8 times)
29th Jul 2016, 8:18 AM
U.S.Praveen Raj
U.S.Praveen Raj - avatar
0
Thanks,Rick.
26th Jul 2016, 3:31 AM
Omar
Omar - avatar
0
++ operator
29th Jul 2016, 5:28 AM
Yadnyesh Ingole
Yadnyesh Ingole - avatar
0
7
29th Jul 2016, 5:04 PM
GAURAV SINGH
GAURAV SINGH - avatar
0
7
3rd Aug 2016, 2:26 PM
jagadeesh
jagadeesh - avatar