C | Functions | Question 4

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

(A) Address of main function
(B) Compiler Error
(C) Runtime Error
(D) Some random value


Answer: (A)

Explanation: Explanation: Name of the function is actually a pointer variable to the function and prints the address of the function. Symbol table is implemented like this.

struct
{
   char *name;
   int (*funcptr)();
}
symtab[] = {
   "func", func,
   "anotherfunc", anotherfunc,
};


My Personal Notes arrow_drop_up



Practice Tags :
Article Tags :
Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.

Recommended Posts:



0 Average Difficulty : 0/5.0
No votes yet.






User Actions