Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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



What will be the result of the following program? char*g() { static char x[1024]; return x; } ..

Answer / kalyan chukka

The Answer is Second String

Is This Answer Correct ?    4 Yes 2 No

What will be the result of the following program? char*g() { static char x[1024]; return x; } ..

Answer / abhisheksingh462

Answer is "second string" because both handle same address

Is This Answer Correct ?    2 Yes 2 No

Post New Answer

More C Interview Questions

code for copying two strings with out strcpy() function.

6 Answers  


What 'lex' does?

0 Answers   Tech Mahindra,


What is the difference between malloc() and calloc() function in c language?

0 Answers  


what is pointer

1 Answers   TCS,


How to create struct variables?

0 Answers  


1234554321 1234 4321 123 321 12 21 1 1 12 21 123 321 1234 4321 1234554321

0 Answers  


What is volatile variable how do you declare it?

0 Answers  


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

5 Answers   Wipro,


What is c language used for?

0 Answers  


How to avoid buffer overflow?

1 Answers  


find the output of the following program main() { int x=5, *p; p=&x; printf("%d",++*p); }

10 Answers   Amdocs, TCS,


write a c program that prints all multiples of 3between 1 and 50.

5 Answers  


Categories