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
what is the diffrenet bettwen HTTP and internet protocol
Is c++ based on c?
Explain how can I right-justify a string?
What is the use of #include in c?
What is the difference between array and structure in c?
Is there a way to jump out of a function or functions?
What is a spanning Tree?
What is sizeof int?
What are pointers?
write a program in c language to print your bio-data on the screen by using functions.
is it possible to create your own header files?
Why are all header files not declared in every c program?
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
Explain the difference between #include "..." And #include <...> In c?
Apart from dennis ritchie who the other person who contributed in design of c language.