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
Write a program to swap two numbers without using a temporary variable?
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
How can you call a function, given its name as a string?
What are the Advantages of using macro
What does. int *x[](); means ?
What are the advantage of c language?
What are the different types of objects used in c?
What are different types of operators?
What are global variables and how do you declare them?
What is const and volatile in c?
can we implement multi-threads in c.
Why can't I perform arithmetic on a void* pointer?
How is a pointer variable declared?
I need a sort of an approximate strcmp routine?
Why do we use pointer to pointer in c?