![]() Examples char str = "Hello\0" /* sizeof = 7, Explicit Implicit NUL */Ĭhar str= "Hello\0" /* sizeof = 5, str is "Hello" with no NUL (no longer a C-string, just an array of char). Note that had you declared str as char str= "Hello\0" the length would be 6 because the implicit NUL is only added if it can fit (which it can't in this example.) The length of the array is 7, the NUL character \0 still counts as a character and the string is still terminated with an implicit \0
0 Comments
Leave a Reply. |