What is the Output ?
What is the Output ?
Answer : NULL
- 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.
main ()
{
char *p1="Name";
char *p2;
p2=(char *)malloc(20);
while(*p2++=*p1++);
printf("%s\n",p2);
} Answer : NULL
Our site uses cookies. By using this site, you agree to the Privacy Policy and Terms of Use.
We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.