main()
{
char *p1="Name";
char *p2;
p2=(char *)malloc(20);
while(*p2++=*p1++);
printf("%s\n",p2);
}
what is the output?
Answer Posted / shruti
-> while(*p2++ "=" *p1++)
the syntax of while is
while("condition");
in condition statement the assignment operator is used in a
wrong way..
when we are using loop it should be "=="..
we cannot copy the value of p1 in p2, the way its mentioned
here..
** It will either give an error or display some garbage
value in p2 , or no value..
depends on what p2 is initialised to implicitly..
| Is This Answer Correct ? | 1 Yes | 12 No |
Post New Answer View All Answers
What is structure in c definition?
a function gets called when the function name is followed by a a) semicolon (;) b) period(.) c) ! d) none of the above
Can a pointer be volatile in c?
What is variable and explain rules to declare variable in c?
What does it mean when a pointer is used in an if statement?
What is the purpose of sprintf?
hi to every one .. how to view table pool after creating the pooled table? plz help me.. if any knows abt this ..
What is the value of c?
Is c weakly typed?
Can the size of an array be declared at runtime?
Is Exception handling possible in c language?
What are structure types in C?
What is the use of pointers in C?
what is the different bitween abap and abap-hr?
Why are algorithms important in c program?