main()
{
char *p1="Name";
char *p2;
p2=(char *)malloc(20);
while(*p2++=*p1++);
printf("%s\n",p2);
}
what is the output?
Answer Posted / sanath
ANS: NULL
It is a bit tricky question. If u observe carefully then we
are incrementing the pointers p1,p2. When it reached the end
of the string, *p2 points to NULL. We have lost the address
of the starting position.
| Is This Answer Correct ? | 40 Yes | 5 No |
Post New Answer View All Answers
What is the meaning of ?
Is there a way to compare two structure variables?
Explain what is page thrashing?
What is a program flowchart and how does it help in writing a program?
How to set file pointer to beginning c?
Define VARIABLE?
In C, What is the #line used for?
what do you mean by enumeration constant?
Why static is used in c?
What is the package for freshers(Non IIT) in amazon(hyderabad). And what is the same for those who are a contract employee.
What is d'n in c?
How are 16- and 32-bit numbers stored?
write a program to rearrange the array such way that all even elements should come first and next come odd
Explain how can I read and write comma-delimited text?
The performance of an operation in several steps with each step using the output of the preceding step a) recursion b) search c) call by value d) call by reference