Ask Question | Take Test

What will be the result of the following p...

0

What will be the result of the following program?

char *gxxx() {static char xxx[1024]; return xxx; } main() {char *g="string"; strcpy(gxxx(),g); g = gxxx(); strcpy(g,"oldstring"); printf("The string is : %s",gxxx()); }
  1. The string is : string
  2. The string is :Oldstring
  3. Run time error/Core dump
  4. Syntax error during compilation
Asked By : PaviCategory : C
Answer
b. The string is :Oldstring

Copyright © Interviewkiller.com - Job Interview Questions and Answers - Recruitment Tips