Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

C | Functions | Question 4

  • Difficulty Level : Easy
  • Last Updated : 06 Feb, 2013


Take a step-up from those "Hello World" programs. Learn to implement data structures like Heap, Stacks, Linked List and many more! Check out our Data Structures in C course to start learning today.



#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
Recommended Articles
Page :

Start Your Coding Journey Now!