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
why use "return" statement a) on executing the return statement it immediately transfers the control back to the calling program b) it returns the value present in the parentheses return, to the calling program c) a & b d) none of the above
What is the difference between pure virtual function and virtual function?
How do we print only part of a string in c?
Write a program to implement queue.
What is equivalent to ++i+++j?
pgm to find any error in linklist(in single linklist check whether any node points any of previous nodes instead of next node)
What is a static variable in c?
the maximum length of a character constant can be a) 1 character b) 8 characters c) 256 chaacters d) 125 characters
What is file in c preprocessor?
What would the following code segment printint k = 8;docout << "k = " << k << " ";while k++ < 5; a) 13 b) 5 c) 8 d) pointers
Why use int main instead of void main?
Write a program to display all the prime nos from 1 to 1000000, your code should not take time more than a minute to display all the nos.
Explain can the sizeof operator be used to tell the size of an array passed to a function?
What do you mean by a local block?
What are the types of type specifiers?