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 does the error 'Null Pointer Assignment' mean and what causes this error?
What are the key features in c programming language?
What are the rules for the identifier?
What is variable in c example?
What is the function of this pointer?
What are the preprocessor categories?
Where register variables are stored in c?
Explain what is the best way to comment out a section of code that contains comments?
What's the difference between constant char *p and char * constant p?
What is nested structure with example?
What is #include stdio h?
Do you know the use of 'auto' keyword?
WRITE A CODE IN C TO SEARCH A FILE FROM NOTEPAD FILE.
Give basis knowledge of web designing ...
Describe the order of precedence with regards to operators in C.