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

Can a pointer point to null?

1019


What is variable initialization and why is it important?

1160


How can you determine the size of an allocated portion of memory?

1235


Can main () be called recursively?

1058


How can I get back to the interactive keyboard if stdin is redirected?

1132


What is meant by 'bit masking'?

1333


What is the purpose of sprintf?

1061


How can I automatically locate a programs configuration files in the same directory as the executable?

1102


What does the format %10.2 mean when included in a printf statement?

1584


Write a program, where i have a grid with many cells, how many paths are possible from one point to other desired points.

1184


Explain can static variables be declared in a header file?

1103


What are identifiers c?

1017


which is an algorithm for sorting in a growing Lexicographic order

1743


Why can’t constant values be used to define an array’s initial size?

1321


What is an arrays?

1024