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 a node in c?
Is there a way to jump out of a function or functions?
What are global variables and explain how do you declare them?
Array is an lvalue or not?
program to find out date after adding 31 days to a date in the month of febraury also consider the leap year
Explain why can’t constant values be used to define an array’s initial size?
What is a pointer and how it is initialized?
Why is sprintf unsafe?
c program to compute AREA under integral
What does dm mean sexually?
hai iam working in sap sd module for one year and working in lumax ind ltd in desp department but my problem is i have done m.b.a in hr/marketing and working sap sd there is any combination it. can you give right solution of my problem. and what can i do?
What does %c mean in c?
Why do we use & in c?
What is the advantage of c?
What is restrict keyword in c?