null terminating a string

前端 未结 4 736
有刺的猬
有刺的猬 2020-11-29 05:48

gcc 4.4.4 c89

What is the standard way to null terminate a string? When I use the NULL I get a warning message.

*dest++ = 0; 
*dest++ =          


        
4条回答
  •  时光取名叫无心
    2020-11-29 06:13

    From the comp.lang.c FAQ: http://c-faq.com/null/varieties.html

    In essence: NULL (the preprocessor macro for the null pointer) is not the same as NUL (the null character).

提交回复
热议问题