Sunday, 4 January 2015

Programming Quiz-57



struct Foo
  {
  char *pName;
 };

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

a. “Your Name” 

b. compile error
c. “Name” 

d. Runtime error 

Answer: A

No comments:

Post a Comment