What is \0 in C language and what is it's use? (with example please). | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

What is \0 in C language and what is it's use? (with example please).

25th Dec 2019, 1:56 PM
Manthan Gohel
Manthan Gohel - avatar
3 Answers
+ 3
'\0' is referred to as NULL character or NULL terminator It is the character equivalent of integer 0(zero) as it refers to nothing In C language it is generally used to mark an end of a string. example string a="Arsenic"; every  character stored in array a[0]=A a[1]=r a[2]=s a[3]=e a[4]=n a[5]=i a[6]=c end of the array contain ''\0' to stop the array memory allocation for string 'a'.
25th Dec 2019, 2:07 PM
Arsenic
Arsenic - avatar
+ 4
M.Yoganayaki is right. \0 is a null character in C!! 😄
26th Dec 2019, 4:03 PM
Shayokh Shuvro
Shayokh Shuvro - avatar
+ 3
In c ,\0 is known as null character. Basically, In string concept, string is complete with this null character.
25th Dec 2019, 2:59 PM
M.Yoganayaki
M.Yoganayaki - avatar