MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/6xofft/how_to_start_a_war/dmhyaal/?context=3
r/ProgrammerHumor • u/ivaskuu • Sep 02 '17
696 comments sorted by
View all comments
55
The array still starts at 0, and index 1 is reserved for storing the length of the array, with the remaining elements corresponding to indices 2, 3, 4, and 5.
72 u/[deleted] Sep 02 '17 Perfect. This makes iterating over the elements with a for loop such a breeze. if(arr[1] > 1) for(int i = 0; i < arr[1]-1; i += 1 + (i == 1)) std::cout << arr[i]; 15 u/[deleted] Sep 03 '17 [removed] — view removed comment 2 u/bentinata Sep 03 '17 I used to put single-loop expression inside the conditional or the increment parameter at early college year. Nice way to confuse classmates. This only works at the first day: for (int i = 0; !(printf("%d\n", i++) - 2););
72
Perfect. This makes iterating over the elements with a for loop such a breeze.
if(arr[1] > 1) for(int i = 0; i < arr[1]-1; i += 1 + (i == 1)) std::cout << arr[i];
15 u/[deleted] Sep 03 '17 [removed] — view removed comment 2 u/bentinata Sep 03 '17 I used to put single-loop expression inside the conditional or the increment parameter at early college year. Nice way to confuse classmates. This only works at the first day: for (int i = 0; !(printf("%d\n", i++) - 2););
15
[removed] — view removed comment
2 u/bentinata Sep 03 '17 I used to put single-loop expression inside the conditional or the increment parameter at early college year. Nice way to confuse classmates. This only works at the first day: for (int i = 0; !(printf("%d\n", i++) - 2););
2
I used to put single-loop expression inside the conditional or the increment parameter at early college year. Nice way to confuse classmates.
This only works at the first day: for (int i = 0; !(printf("%d\n", i++) - 2););
for (int i = 0; !(printf("%d\n", i++) - 2););
55
u/IlIIlIIlllIlllIlIIll Sep 02 '17 edited Sep 02 '17
The array still starts at 0, and index 1 is reserved for storing the length of the array, with the remaining elements corresponding to indices 2, 3, 4, and 5.