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 |
code for copying two strings with out strcpy() function.
What 'lex' does?
What is the difference between malloc() and calloc() function in c language?
what is pointer
How to create struct variables?
1234554321 1234 4321 123 321 12 21 1 1 12 21 123 321 1234 4321 1234554321
What is volatile variable how do you declare it?
what is output? main() { #define SQR(x) x++ * ++x int i = 3; printf(" %d %d ",SQR(i),i * SQR(i)); } a)9 27 b)35 60 c)20 60 d)15 175
What is c language used for?
How to avoid buffer overflow?
find the output of the following program main() { int x=5, *p; p=&x; printf("%d",++*p); }
write a c program that prints all multiples of 3between 1 and 50.