Null character? | SoloLearn: Learn to code for FREE!


Null character?

what is the importance of null character at end of strings in c ?

8/9/2018 5:02:39 PM

Ahmed Mamdouh

3 Answers

New Answer


it's added like a last character in all string.its character only...for example, "hi" has two characters h and i..but actually it has three characters.. h, i and null character... compiler internally uses character called null to terminate string


Ahmed Mamdouh in c, string is considered as char array... termination of string is defined by null character... This null character plays internal role in c++ string headers for which we don't have to worry much...


so it's just to be considered as a string .. not a character .. regarding header functions right ? another question plz .. why does header has implantation. . it suppose to be just definitions?