Programming magic, glory, and juices.

End Of String Comparision

April 16th, 2009


I’ve been checking for the end of a string the following ways…

while (*String != '\0')

or

while (*String != L'\0')

But have found out that it is better to use 0 instead of ‘\0′ when looking for the end of a string. Comparing to 0 works with both ascii and unicode strings, whereas comparing to ‘\0′ only works for ascii strings. For unicode strings you would have to do L’\0′.

while (*String != 0)
One Response to “End Of String Comparision”
  1. Jae
     

    i need help with the program, i try to download seperate RAR files, but cant seem to get it to work. what am i doing wrong?

Leave a Reply