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
Answers were Sorted based on User's Feedback
Answer / abhisheksingh462
Answer is "second string" because both handle same address
| Is This Answer Correct ? | 2 Yes | 2 No |
What is union and structure in c?
What is time complexity c?
What is console in c language?
Explain the advantages of using macro in c language?
for(i=1;i>0;i++); printf("i=%d",i); what will be the answer????
write a program to print infinte number
How to implement variable argument functions ?
what will happen if you free a pointer twice after allocating memory dynamically ?
What is a shell structure examples?
Do you know the purpose of 'register' keyword?
What is a substring in c?
6. Which of the Following is not defined in string.h? A)strspn() B)strerror() C)memchr() D)strod()