Talk:Array: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
No edit summary
Line 4: Line 4:


:Thats why strings are ''supposed'' to be stored as a char* not a char[] --[[User:InvaderZim|InvaderZim]]
:Thats why strings are ''supposed'' to be stored as a char* not a char[] --[[User:InvaderZim|InvaderZim]]
:Technically strings are terminated with a '\0' character (a character with all bits zero, referred to in the C standard as the null character, all lowercase).  On systems that use ASCII this will be the character referred to as NUL (with one L).  None of these should be confused a null pointer constant which is 'An integer constant expression with the value 0, or such an expression cast to type void *'.  The inclusion of any of several standard headers will also cause the definition of the macro NULL which 'expands to an implementation-defined null pointer constant'.  So, depending on the implementation's definition of NULL, the null character and NULL are not necessarily compatible. --[[User:PhilipS|Phil]]

Revision as of 12:22, 13 September 2005

Aren't strings more normally terminated with a NULL? ;-) --Cargo Cult 15:00, 24 Jul 2005 (PDT)

If they're null-terminating strings ;) --ts2do
Thats why strings are supposed to be stored as a char* not a char[] --InvaderZim
Technically strings are terminated with a '\0' character (a character with all bits zero, referred to in the C standard as the null character, all lowercase). On systems that use ASCII this will be the character referred to as NUL (with one L). None of these should be confused a null pointer constant which is 'An integer constant expression with the value 0, or such an expression cast to type void *'. The inclusion of any of several standard headers will also cause the definition of the macro NULL which 'expands to an implementation-defined null pointer constant'. So, depending on the implementation's definition of NULL, the null character and NULL are not necessarily compatible. --Phil