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 / anu

the output wll be hello , since the argument is overwritten
with new memory in the function.

so in main, when it comes to printf, p points to the
allocatd memory, which contains hello

Is This Answer Correct ?    0 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What should malloc() do? Return a null pointer or a pointer to 0 bytes?

1070


writ a program to compare using strcmp VIVA and viva with its output.

2018


When should the const modifier be used?

1104


What is action and transformation in spark?

1160


Suggesting that there can be 62 seconds in a minute?

1044


What are linked lists in c?

1126


illustrate the use of address operator and dereferencing operator with the help of a program guys plzzz help for this question

2071


Tell me can the size of an array be declared at runtime?

1037


What is wrong with this program statement?

1034


Write a program to implement a round robin scheduler and calculate the average waiting time.Arrival time, burst time, time quantum, and no. of processes should be the inputs.

1097


Write a program for finding factorial of a number.

1086


Can you write the function prototype, definition and mention the other requirements.

1130


what is the difference between 123 and 0123 in c?

1201


Is array a primitive data type in c?

1055


Do you know null pointer?

1021