Doubt in reading sentences

Hello, I was trying to run this code :

But why it is giving me error ?

hello @yashsharma4304 there was problem in the condition which you have made in the while loop.
becuase this β€˜\0’ is not considered as the single character that’s why it was giving the error .
if you still have any doubt you can ask here .
Happy LEarning !!

Yeah, I also think about that. But it is a null character so it should be considered as a single character ?

character considers a letter at time .

yes but I am saying that \0 is also a single character ? It is a null character

please read the line carefully here it is clearly mentioned that it is used in string .but you are applying on character .
for better understanding see this code of null also on string .
https://ide.codingblocks.com/s/334764.

character is considered or used to take singe character only at a time .
so that’s why it is treating β€˜β€™ and β€˜0’ in β€˜\0’ as individual characters .

1 Like

please read the line carefully here it is clearly mentioned that it is used in string

Ok :relaxed: