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
How do I create a directory? How do I remove a directory (and its contents)?
Write a program to compute the similarity between two strings - The program should get the two strings as input - Then it will output one single number which is the percentage of similarity between the two strings
How many levels of pointers can you have?
what do you mean by inline function in C?
What is n in c?
how to find binary of number?
What is enumerated data type in c?
What is the best way to store flag values in a program?
Write a program on swapping (100, 50)
Why do we need volatile in c?
What is a loop?
In C language, the variables NAME, name, and Name are all the same. TRUE or FALSE?
What is the use of a semicolon (;) at the end of every program statement?
List the variables are used for writing doubly linked list program.
how is the examination pattern?