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 does void main return?
How is a two dimensional array passed to function when the order of matrix is not known at complie time?
in linking some of os executables are linking name some of them
1.what are local and global variables? 2.what is the scope of static variables? 3.what is the difference between static and global variables? 4.what are volatile variables? 5.what is the use of 'auto' keyword? 6.how do we make a global variable accessible across files? Explain the extern keyword? 7.what is a function prototype? 8.what does keyword 'extern' mean in a function declaration?
How can I get back to the interactive keyboard if stdin is redirected?
there is two conditions , 1. while using for loop for printing 1 to 50 no's simulteneous 2. while using printf functios for printing 1 to 50 no's simulteneous with or without using variables who will take more time for compiling and execution? explain in details with reason?
cin.ignore(80, _ _);This statement a) ignores all input b) ignores the first 80 characters in the input c) ignores all input till end-of-line d) iteration
int a=1,b=2,c=3; printf("%d,%d",a,b,c); What is the output?
What are terms in math?
Why ordinary variable store only one value
Explain what will be the outcome of the following conditional statement if the value of variable s is 10?
What is clrscr ()?