Null character? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Null character?

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

9th Aug 2018, 5:02 PM
Ahmed Mamdouh
Ahmed Mamdouh - avatar
3 Answers
+ 5
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
9th Aug 2018, 5:21 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
+ 1
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...
9th Aug 2018, 5:14 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
0
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?
9th Aug 2018, 5:17 PM
Ahmed Mamdouh
Ahmed Mamdouh - avatar