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 |
Why does everyone say not to use gets?
What is echo in c programming?
#define MAX(x,y) (x) > (y) ? (x) : (y) main() { int i = 10, j = 5, k = 0; k = MAX(i++, ++j); printf("%d %d %d", i,j,k); } what will the values of i , j and k? }
14 Answers CDAC, GATE, NDS, TCS,
What is pointer to pointer in c language?
write a c program to print the next of a particular no without using the arithmetic operator or looping statements?
How to use c/c++ code in JAVA
10 Answers CDAC, IBM, Satyam, Scope International,
main() { int i=0; while(+(+i--)!=0) i-=i++; printf(i); }
about c language
what is difference between procedural language and functional language ?
struct ptr { int a; char b; int *p; }abc; what is d sizeof structure without using "sizeof" operator??
How many types of arrays are there in c?
What is the use of define in c?