What is the Output ?

Answer : NULL…

What is the Output ?

[pastacode lang=”c” manual=”main%20()%20%0A%20%20%7B%0A%20%20char%20*p1%3D%22Name%22%3B%20%0A%20%20char%20*p2%3B%20%0A%20%20p2%3D(char%20*)malloc(20)%3B%20%0A%20%20while(*p2%2B%2B%3D*p1%2B%2B)%3B%20%0A%20%20printf(%22%25s%5Cn%22%2Cp2)%3B%20%0A%20%20%7D%20″ message=”” highlight=”” provider=”manual”/]

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.
Leave a Reply

Your email address will not be published. Required fields are marked *

You May Also Like