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
Why is struct padding needed?
number of times a digit is present in a number
What is the difference between typedef struct and struct?
Why is c so popular?
What is a #include preprocessor?
The process of repeatedly running a set of computer instructions until some condition is specifed a) condition b) sequential condition c) global d) iteration
What is structure in c explain with example?
What is the scope of static variable in c?
Explain what is a program flowchart and explain how does it help in writing a program?
What is the use of extern in c?
What are the different types of control structures?
How do you declare a variable that will hold string values?
What's the best way of making my program efficient?
Can a pointer be static?
Explain the array representation of a binary tree in C.