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
What is getch() function?
What does sizeof function do?
What is binary tree in c?
Can a program have two main functions?
What functions are used in dynamic memory allocation in c?
What are enums in c?
What does c mean in standard form?
`write a program to display the recomended action depends on a color of trafic light using nested if statments
What is the heap?
What is use of null pointer in c?
Explain how can you determine the size of an allocated portion of memory?
Explain what is a pragma?
What is the best way of making my program efficient?
What is spark map function?
What is meant by type specifiers?