Machine-translated by Google. Questions are authored in English.
Top

Discussion

What is the output of this program?

#include <stdio.h>
void main()
{
  struct number
  {
    int no;
    char name[20];
  };
  struct number s;
  s.no = 50;
  printf("%d", s.no);
}

 

  • A.Nothing
  • B.Compile time error
  • C.Junk
  • D.50

Answer: D

Correct answer: 50

Declaring the structure type inside a function is legal - it is simply local to that block. The member is set and printed, giving 50.

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

Post your comment

Please log in or register to post a comment.