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

Do you have any idea about the use of "auto" keyword?

648


What is #ifdef ? What is its application?

633


hello freinds next week my interview in reliance,nybody has an idea about it intervew questions..so tell

1651


What is #line in c?

550


Explain what is the advantage of a random access file?

648






What are the 4 types of organizational structures?

611


What is c system32 taskhostw exe?

569


disply the following menu 1.Disply 2.Copy 3.Append; as per the menu do the file operations 4.Exit

1615


How is actual parameter different from the formal parameter?

579


How many identifiers are there in c?

564


How to write a code for implementing my own printf() and scanf().... Please hep me in this... I need a guidance... Can you give an coding for c... Please also explain about the header files used other than #include...

4894


What is the use of the function in c?

587


How are variables declared in c?

582


What is the significance of scope resolution operator?

837


Where are c variables stored in memory?

584