Join Examsbook
726 0

Q: What would be the output of the following program? main() {    struct emp    {         char *n;         int age;    };    struct emp e1 = { "Dravid", 23};    struct emp e2 = e1;    strupr (e2.n);    printf ("\n%s",e1.n); }

  • Show AnswerHide Answer
  • Workspace

Answer :
Explanation :

DRAVID When a structure is assigned, passed, or returned, the copying is done monolithically. This means that the copies of any pointer fields will point to the same place as the original. In other words, anything pointed to is not copied. Hence, on changing the name through e2.n it automatically changed e1.n

Are you sure

  Report Error

Please Enter Message
Error Reported Successfully