4

これは私のコードです:

#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <stdlib.h>

static int valid_line(char *cur_line) {
    if (*cur_line == '#') {
        return 0;
    }

    char *end = strchrnul(cur_line, '#');

    while(end > cur_line && isspace(*end)) end--;
    return (!(*cur_line == *end));
}

私は行を通過し、先頭と末尾の空白、および「#」の後に発生するもの (「#」を含む) をすべて取り除きます。

私のコンパイラはこれを言っています:

parser.c:20:2: warning: implicit declaration of function ‘strchrnul’ [-Wimplicit-    function-declaration]
parser.c:20:14: warning: initialisation makes pointer from integer without a cast [enabled by default]

私はstring.h上記を持っていますが。

誰か説明してくれませんか。

4

2 に答える 2