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


Please Help Members By Posting Answers For Below Questions

Write a code to generate a series where the next element is the sum of last k terms.

994


What are compound statements?

862


What are different storage class specifiers in c?

879


What are the disadvantages of external storage class?

831


please send me the code for multiplying sparse matrix using c

1949


What is function prototype?

804


What does %c do in c?

796


What are the ways to a null pointer can use in c programming language?

898


List a few unconditional control statement in c.

782


What is difference between %d and %i in c?

931


What are categories used for in c?

823


What is c++ used for today?

891


Explain the use of 'auto' keyword in c programming?

920


What is #include called?

822


Explain about C function prototype?

850