What will be the result of the following program?
char*g()
{
static char x[1024];
return x;
}
main()
{
char*g1="First String";
strcpy(g(),g1);
g1=g();
strcpy(g1,"Second String");
printf("Answer is:%s", g());
}
(A) Answer is: First String (B) Answer is: Second String
(C) Run time Error/Core Dump (D) None of these

Answer Posted / kalyan chukka

The Answer is Second String

Is This Answer Correct ?    4 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is there a way to compare two structure variables?

611


which of the following is allowed in a "C" arithematic instruction a) [] b) {} c) () d) none of the above

1125


What does the && operator do in a program code?

690


Explain Function Pointer?

681


How main function is called in c?

622






Is there anything like an ifdef for typedefs?

694


Can 'this' pointer by used in the constructor?

608


Explain what header files do I need in order to define the standard library functions I use?

645


What is volatile variable in c?

654


The number of bytes of storage occupied by short, int and long are a) 2, 2 and 4 b) 2, 4 and 4 c) 4, 4 and 4 d) none

759


What is C language ?

1522


any limit on the number of functions that might be present in a C program a) max 35 functions b) max 50 functions c) no limit d) none of the above

628


How do you redirect a standard stream?

618


Who developed c language and when?

573


What is difference between structure and union with example?

588