What if a null character is present in the middle of a string?
<p>I understand that the end of a string is indicated by a null character, but i cannot understand the output of the following code.</p>

<pre><code>#include &lt;stdio.h&gt;
#include &lt;string.h&gt;

int
main(void)
{
    char s[] = "Hello\0Hi";
    printf("%d %d", strlen(s), sizeof(s));
}
</code></pre>

<p>OUTPUT: <b>5 9 </b></p>

<p>If <code>strlen()</code> detects the end of the string at the end of o, then why doesn't <code>sizeof()</code> do the same thing? Even if it doesn't do the same thing, isn't '\0' <b> A </b> null character (i.e, only one character), so shouldn't the answer be 8?</p>