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 are the keywords in c?
What are qualifiers and modifiers c?
Differentiate between full, complete & perfect binary trees.
How are 16- and 32-bit numbers stored?
How to get string length of given string in c?
What is difference between static and global variable in c?
What does c mean?
Explain what is the general form of a c program?
What is a nested formula?
How can you increase the size of a dynamically allocated array?
what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;
What is the use of sizeof () in c?
Why c is a mother language?
.find the output of the following program? char*myfunc(char*ptr) { ptr +=3; return (ptr); } int main() { char*x,*y; x="HELLO"; y=myfunc(x); printf("y = %s ",y); return 0; }
What is New modifiers?