My function should list all the elements of the char array on the screen. But it should stop if the array is finished. The size of the arrays are variable. I thought that the array is terminated by '\0'. So I did this:
for(int i=0; i< size; i++){
if(word[i] != '\0')
cout<< word[i];
}
But the program doesn't stop there. It creates some random symbol.
E.g. char number[]= "0123"
The program gives: 0123§&
What is wrong with my if-condition?