为什么这个程序中printf的使用有误?

Cha*_*tem 0 c function-pointers

我在回答C中的函数指针如何工作时看到了这个示例代码

#import <stdlib.h>
#define MAX_COLORS  256

typedef struct {
    char* name;
    int red;
    int green;
    int blue;
} Color;

Color Colors[MAX_COLORS];


void eachColor (void (*fp)(Color *c)) {
    int i;
    for (i=0; i<MAX_COLORS; i++)
        (*fp)(&Colors[i]);
}

void printColor(Color* c) {
    if (c->name)
        printf("%s = %i,%i,%i\n", c->name, c->red, c->green, c->blue);
}

int main() {
    Colors[0].name="red";
    Colors[0].red=255;
    Colors[1].name="blue";
    Colors[1].blue=255;
    Colors[2].name="black";

    eachColor(printColor);
}
Run Code Online (Sandbox Code Playgroud)

该代码返回以下错误:

test.c: In function ‘printColor’:
test.c:21: warning: incompatible implicit declaration of built-in function ‘printf’
Run Code Online (Sandbox Code Playgroud)

Ed *_* S. 5

printf生活在stdio.h,而不是stdlib.h.