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
Can you explain what keyboard debouncing is, and where and why we us it? please give some examples
What is a #include preprocessor?
swap 2 numbers without using third variable?
What is structure padding and packing in c?
how can i write a program that prints out a box such that whenever i press any key8(coordinate number) on the keyboard, the box moves.
Explain built-in function?
What are the 3 types of structures?
How can I call fortran?
How many types of sorting are there in c?
What is nested structure?
Why is this loop always executing once?
How many levels of pointers can you have?
What is the use of bit field?
Explain how many levels deep can include files be nested?
What does a pointer variable always consist of?