MCQ Single Best Answer Not Set

QWhat is the output of this C code?

    #include <stdio.h>
    struct student
    {
        char *name;
    };
    struct student s;
    struct student fun(void)
    {
        s.name = "newton";
        printf("%s\n", s.name);
        s.name = "alan";
        return s;
    }
    void main()
    {
        struct student m = fun();
        printf("%s\n", m.name);
        m.name = "turing";
        printf("%s\n", s.name);
    }

ID: #2633 Structure in C Language 2,182 views
Question Info
#2633Q ID
Not SetDifficulty
Structure in C LanguageTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A newton alan alan
  • B alan newton alan
  • C alan alan newton
  • D Compile time error
Correct Answer: Option A

Explanation

None

Share This Question

Challenge a friend or share with your study group.