main()
{
char *p1="Name";
char *p2;
p2=(char *)malloc(20);
while(*p2++=*p1++);
printf("%s\n",p2);
}

Answer Posted / vignesh1988i

actually in this problem, the p2 will take characters after '\0' too from p1 upto the size of p2 come to an end.

so it prints
output :

Name #^$&dhd


thank u

Is This Answer Correct ?    1 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write a program to swap two numbers without using a temporary variable?

612


To print the pattern 1 2 3 4 5 10 17 18 19 6 15 24 25 20 7 14 23 22 21 8 13 12 11 10 9

2191


How can you call a function, given its name as a string?

715


What are the Advantages of using macro

688


What does. int *x[](); means ?

639






What are the advantage of c language?

554


What are the different types of objects used in c?

578


What are different types of operators?

598


What are global variables and how do you declare them?

622


What is const and volatile in c?

567


can we implement multi-threads in c.

670


Why can't I perform arithmetic on a void* pointer?

639


How is a pointer variable declared?

595


I need a sort of an approximate strcmp routine?

661


Why do we use pointer to pointer in c?

600