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


Please Help Members By Posting Answers For Below Questions

What does the error 'Null Pointer Assignment' mean and what causes this error?

952


What are the key features in c programming language?

798


What are the rules for the identifier?

862


What is variable in c example?

786


What is the function of this pointer?

861






What are the preprocessor categories?

803


Where register variables are stored in c?

720


Explain what is the best way to comment out a section of code that contains comments?

906


What's the difference between constant char *p and char * constant p?

872


What is nested structure with example?

800


What is #include stdio h?

889


Do you know the use of 'auto' keyword?

845


WRITE A CODE IN C TO SEARCH A FILE FROM NOTEPAD FILE.

2225


Give basis knowledge of web designing ...

1757


Describe the order of precedence with regards to operators in C.

815