Why does this cycle only run 4 times?
2 answers
Because when any input is entered from the keyboard, we need to hit enter to confirm the completion of the input. This enter stays in the buffer and if the next input is a char or string, stores enter a string or char var and do not wait for that char or string to be input. In this case, the first input given on execution stores char in X [0] and enters x [1], and so on. So the loop is executed 8 times, but it seems 4 times because it only asks for input four times. To test to put one printf in a loop
+3
source to share