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 |
Convert a distance from miles to kilometers .there are 5280 feets per mile,12 inches per foot .2.54 centimeters per inch and 100000centimeters per kilometer
Can one function call another?
What are the scope of static variables?
How is a null pointer different from a dangling pointer?
Explain the use of fflush() function?
What are the advantages of c preprocessor?
what is the output of the program and explain why?? #include<stdio.h> void main ( ) { int k=4,j=0: switch (k) { case 3; j=300; case 4: j=400: case 5: j=500; } printf (ā%d\nā,j); }
what is c programming?
What is a static variable in c?
Why do u use # before include in a C Progam?
Why doesn't the code "int a = 1000, b = 1000; long int c = a * b;" work?
How do I send escape sequences to control a terminal or other device?