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
Write a code to generate a series where the next element is the sum of last k terms.
What are compound statements?
What are different storage class specifiers in c?
What are the disadvantages of external storage class?
please send me the code for multiplying sparse matrix using c
What is function prototype?
What does %c do in c?
What are the ways to a null pointer can use in c programming language?
List a few unconditional control statement in c.
What is difference between %d and %i in c?
What are categories used for in c?
What is c++ used for today?
Explain the use of 'auto' keyword in c programming?
What is #include called?
Explain about C function prototype?