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
How many levels of pointers have?
What is nested structure with example?
Explain how can you tell whether a program was compiled using c versus c++?
Explain what are preprocessor directives?
Can you subtract pointers from each other? Why would you?
Is anything faster than c?
given post order,in order construct the corresponding binary tree
please explain every phase in the "SDLC" in the dotnet.
Tell me about low level programming languages.
which of the following is not a character constant a) 'thank you' b) 'enter values of p, n ,r' c) '23.56E-o3' d) all of the above
When should we use pointers in a c program?
why return type of main is not necessary in linux
What is hashing in c?
What tq means in chat?
What are the types of operators in c?