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 wrong with this statement? Myname = 'robin';
What is the difference between malloc() and calloc() function in c language?
List the different types of c tokens?
Explain the use of 'auto' keyword
Why c is called object oriented language?
Write program to remove duplicate in an array?
How can I change their mode to binary?
What is use of null pointer in c?
can any one tel me wt is the question pattern for NIC exam
What is ctrl c called?
How can you call a function, given its name as a string?
What is meant by high-order and low-order bytes?
What is indirection? How many levels of pointers can you have?
What is the use of header files?
What is a sequential access file?