Sunday, 4 January 2015

Programming Quiz-58


struct Foo
  {
      char *pName;
     char *pAddress;
  };
main()
{
   struct Foo *obj = malloc(sizeof(struct Foo));
   obj->pName = malloc(100);
   obj->pAddress = malloc(100);
   strcpy(obj->pName,"Your Name");
   strcpy(obj->pAddress, "Your Address");
   free(obj);
   printf("%s", obj->pName);
  printf("%s", obj->pAddress);
}

a. “Your Name”, “Your Address” 

b. “Your Address”, “Your Address” 
c. “Your Name” “Your Name” 
d. None of the above 

Answer: D

No comments:

Post a Comment