Anonymous user
Empty string: Difference between revisions
added assigning an empty string
(Added Nemerle) |
(added assigning an empty string) |
||
Line 12:
=={{header|C}}==
In C the strings are <code>char</code> pointers. A string terminates with the null char (U+0000, <code>'\0'</code>), which is not considered part of the string. Thus an empty string is <code>"\0"</code>, while a null string is a null pointer which points to nothing.
<lang C>/*
char *str = "";
/* to test a null string */
if (str) { ... }
/* to test if string is empty */
|