NUL undeclared-在一次使用此功能 [英] NUL undeclared- first use in this function

查看:104
本文介绍了NUL undeclared-在一次使用此功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

网络据我所知,C包含 NUL 关键字。

From the web I understand that C contains NUL keyword.

不过,在编译时,我得到一个错误

But while compiling I get an error

NUL undeclared first use in this function'

我的code片段:

My code fragment:

for (;;) {
        char ch = (*pzDest = *pzSrc);
        if (ch == NUL)
            break;
        if (ch == ':') {
            *pzDest = NUL;
            break;
        }
        pzDest++;
        pzSrc++;
    }

任何想法,为什么我得到这个错误?

Any idea why I get this error?

推荐答案

有的 NULL ,然后出现的 NUL

NULL在STDDEF.H定义,使用非常广泛的,并且是一个空指针引用。

NULL is defined in stddef.h, is used very widely, and is a reference to a null pointer.

NUL是不同的 - 它是在标准ASCII字符集的第一个字符,并且更重要的是,它不是标准的宏的。您可能需要自己定义。

NUL is different - it is the first character in the standard ASCII character set, and more importantly, it is not a standard macro. You may have to define it yourself.

要定义NUL,做的:

#define NUL '\0'

这篇关于NUL undeclared-在一次使用此功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆