Top

Discussion

What will be the output of the following C code? (If the name entered is: Sanfoundry)

#include
#include
typedef struct employee
{
    char  name[50];
    int   salary;
} e1;
void main( )
{
    printf("Enter Employee name");
    scanf("%s",e1.name);
    printf("\n%s",e1.name);
}

 

  • A.Sanfoundry.name
  • B.nSanfoundry
  • C.Sanfoundry
  • D.Error

Answer: D

The code shown above will result in an error because we have used the data type e1 (defined using the keyword typedef) in the form of an identifier.

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

Post your comment