|
|
- /* test.c */
- #include <stdio.h>
- #include <string.h>
- int main()
- {
- char str[12]="sdfASDF";
- char *p=strndup(str, sizeof(str));
- printf("%s\n",str);
- printf("%s\n",p);
- free(p);
- return 0;
- }
复制代码
编译信息:
$ gcc test.c
test.c: 在函数 ‘main’ 中:
test:7: 警告:隐式声明与内建函数 ‘strndup’ 不兼容(英文是incompatible implicit declaration of built-in function 'strndup'. )
这个warning老是无法去除,不知怎么回事? 虽然没有大碍,不过总觉得像个苍蝇:confused: |
|