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
hai iam working in sap sd module for one year and working in lumax ind ltd in desp department but my problem is i have done m.b.a in hr/marketing and working sap sd there is any combination it. can you give right solution of my problem. and what can i do?
Why pointers are used?
How many bytes are occupied by near, far and huge pointers (dos)?
How are portions of a program disabled in demo versions?
Is printf a keyword?
Difference between exit() and _exit() function?
What is an lvalue in c?
What is action and transformation in spark?
how could explain about job profile
When do we get logical errors?
How are strings stored in c?
Who is the main contributor in designing the c language after dennis ritchie?
List the different types of c tokens?
write a c program for swapping two strings using pointer
Does c have circular shift operators?