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 should malloc() do? Return a null pointer or a pointer to 0 bytes?
writ a program to compare using strcmp VIVA and viva with its output.
When should the const modifier be used?
What is action and transformation in spark?
Suggesting that there can be 62 seconds in a minute?
What are linked lists in c?
illustrate the use of address operator and dereferencing operator with the help of a program guys plzzz help for this question
Tell me can the size of an array be declared at runtime?
What is wrong with this program statement?
Write a program to implement a round robin scheduler and calculate the average waiting time.Arrival time, burst time, time quantum, and no. of processes should be the inputs.
Write a program for finding factorial of a number.
Can you write the function prototype, definition and mention the other requirements.
what is the difference between 123 and 0123 in c?
Is array a primitive data type in c?
Do you know null pointer?