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

the outpu is hello coz the pointer is pointing to a
location where the string "bye" is written in the next
program yu are using the same pointer to point to some
other string so it gets overwritten

Is This Answer Correct ?    2 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can we declare variable anywhere in c?

524


What are the different types of control structures in programming?

648


Why do we need arrays in c?

569


What is wrong in this statement? scanf(ā€œ%dā€,whatnumber);

713


Is c object oriented?

528






Explain what are reserved words?

623


How can I call system when parameters (filenames, etc.) Of the executed command arent known until run time?

575


Explain what is a pragma?

577


What is the Purpose of 'extern' keyword in a function declaration?

634


What is #include cctype?

566


What kind of structure is a house?

540


which of the following is allowed in a "C" arithematic instruction a) [] b) {} c) () d) none of the above

1119


Why does notstrcat(string, "!");Work?

628


Explain why C language is procedural?

760


What is #define in c?

605