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

what is the diffrenet bettwen HTTP and internet protocol

1592


Is c++ based on c?

838


Explain how can I right-justify a string?

814


What is the use of #include in c?

812


What is the difference between array and structure in c?

792


Is there a way to jump out of a function or functions?

841


What is a spanning Tree?

1240


What is sizeof int?

837


What are pointers?

856


write a program in c language to print your bio-data on the screen by using functions.

6530


is it possible to create your own header files?

832


Why are all header files not declared in every c program?

819


The performance of an operation in several steps with each step using the output of the preceding step a) recursion b) search c) call by value d) call by reference

931


Explain the difference between #include "..." And #include <...> In c?

797


Apart from dennis ritchie who the other person who contributed in design of c language.

1089