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 |
IS Doon college of Engn.. has good faculty
What are types of preprocessor in c?
Can we change the value of static variable in c?
What is the use of a semicolon (;) at the end of every program statement?
Why does everyone say not to use scanf? What should I use instead?
what is unsigened char and what is the difference from char
What is Full Form of C and Why We use C
Write a program to compare two strings without using the strcmp() function
42 Answers Accenture, Arba Minch University,
a memory of 20 bytes is allocated to a string declared as char *s then the following two statements are executed: s="Etrance" l=strlen(s); what is the value of l ? a.20 b.8 c.9 d.21
how we can say java is platform independent, while we require JVM for that particular Operating System?
#include<stdio.h> void main() { int a,b,c; a=b=c=1; c=++a || ++b && ++c; printf("%d\t%d\t%d",a,b,c); }
what information does the header files contain?
6 Answers BSNL, Cisco, GDA Technologies,