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...

f(char *p)
{
p=(char *)malloc(sizeof(6));
strcpy(p,"HELLO");
}
main()
{
char *p="BYE";
f(p)
printf("%s",p);
}
what is the output?

Answer Posted / vijay

The out put is "BYE".
Because the pointer p dies when function exit with out
return,in main pointer p points to only "BYE",so prinf
prints which p points in main.

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why calloc is better than malloc?

1041


What is meant by type casting?

1056


What is actual argument?

1066


How can I determine whether a machines byte order is big-endian or little-endian?

1067


What are valid signatures for the Main function?

1238


What is the package for freshers(Non IIT) in amazon(hyderabad). And what is the same for those who are a contract employee.

4285


What are the basic data types associated with c?

1273


What is the purpose of 'register' keyword?

1103


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

1110


What are the types of bitwise operator?

1116


What does struct node * mean?

1024


What is data structure in c programming?

1083


Compare and contrast compilers from interpreters.

1121


Can static variables be declared in a header file?

1062


Where static variables are stored in c?

1112