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 / abhisheksingh462
Answer is "second string" because both handle same address
Is This Answer Correct ? | 2 Yes | 2 No |
Post New Answer View All Answers
i = 25;switch (i) {case 25: printf("The value is 25 ");case 30: printf("The value is 30 "); When the above statements are executed the output will be : a) The value is 25 b) The value is 30 c) The value is 25 The value is 30 d) none
Explain the difference between the local variable and global variable in c?
Explain is it valid to address one element beyond the end of an array?
Explain what are bus errors, memory faults, and core dumps?
What is the difference between union and structure in c?
write a program to print the consecutive repeated character from the given string... input string is : hhhhjkutskkkkkggggj output should be like this: hhhhkkkkkgggg anyone help me...
What is array of pointers to string?
Why does everyone say not to use scanf? What should I use instead?
What is string function in c?
which is conditional construct a) if statement b) switch statement c) while/for d) goto
#include
Why c is a procedural language?
Does sprintf put null character?
What are structural members?
How can I implement a delay, or time a users response, with sub-second resolution?