main()
{
char *p1="Name";
char *p2;
p2=(char *)malloc(20);
while(*p2++=*p1++);
printf("%s\n",p2);
}
what is the output?
Answer Posted / vadivel t
In addtion to the answer #5.
printf("%s\n",p2); will print the values from 6th byte to
20th byte.
6th byte to 20th bytes of the memory will contain some
Garbage value. So the output will be a string of garbage
values.
For desired o/p see the ans #5
Is This Answer Correct ? | 6 Yes | 3 No |
Post New Answer View All Answers
what is a constant pointer in C
What is main () in c?
what is recursion in C
Why cant I open a file by its explicit path?
What are register variables in c?
What is #include conio h?
What is the best way to comment out a section of code that contains comments?
what are enumerations in C
When we use void main and int main?
List the difference between a "copy constructor" and a "assignment operator"?
What is the best style for code layout in c?
How to create struct variables?
Is there a way to compare two structure variables?
What is the c language function prototype?
Explain the difference between ++u and u++?