我gcc
使用以下方法编译以下示例-Wall -pedantic
:
#include <stdio.h>
int main(void)
{
printf("main: %p\n", main); /* line 5 */
printf("main: %p\n", (void*) main); /* line 6 */
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我明白了:
main.c:5: warning: format ‘%p’ expects type ‘void *’, but argument 2 has type ‘int (*)()’
main.c:6: warning: ISO C forbids conversion of function pointer to object pointer type
Run Code Online (Sandbox Code Playgroud)
第5行让我更改了第6行中的代码.
在打印功能的地址时删除警告我错过了什么?