0

You may think of this:

#include <stdio.h>
int main(void)
{
        printf("%p\n", main);
        return 0;
}

However, with gcc -std=c11 -pedantic you get:

warning: format '%p' expects argument of type void *, but argument 2 has type int (*)(void) [-Wformat=]

Then you may think of this:

#include <stdio.h>
int main(void)
{
        printf("%p\n", (void*)main);
        return 0;
}

However, with gcc -std=c11 -pedantic you get:

warning: ISO C forbids conversion of function pointer to object pointer type [-Wpedantic]

ForceBru
  • 41,233
  • 10
  • 61
  • 89
pmor
  • 4,392
  • 3
  • 15
  • 27

0 Answers0