Top

Discussion

What will be the output of the following C code?

#include
main()
{
    typedef int a;
    a b=2, c=8, d;
    d=(b*2)/2+8;
    printf("%d",d);
}

 

  • A.10
  • B.16
  • C.8
  • D.error

Answer: A

In the code shown above, the keyword typedef is used to give an alias name (a) to an identifier of the type int. The expression on evaluation gives the answer 10. Hence the output of the code shown above is 10.

No comment is present. Be the first to comment.
Loading…

Post your comment