+ 1
For_loop doubt
https://code.sololearn.com/ctbxIKrtLzlF hi friends , here the expected output is eight nine even odd but with this code ....I am getting output as eightnine nine even odd how can i get ....expected output....?
1 Resposta
+ 3
In C, strings end in a '\0' (NUL) character. Because your declaration is x[...][5], the terminating NUL character of "eight" can not be stored, so printf does not know when eight ends.
Because "eight" and "nine" are stored sequentially in memory, printf continues searching, until it finds nine's '\0'.
To solve this bug, declare it as char x[...][6]