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
How many types of functions are there in c?
How can I dynamically allocate arrays?
printf(), scanf() these are a) library functions b) userdefined functions c) system functions d) they are not functions
Is register a keyword in c?
a c variable cannot start with a) an alphabet b) a number c) a special symbol d) both b and c above
What does 2n 4c mean?
find the value of y y = 1.5x+3 for x<=2 y = 2x+5 for x>2
What will the code below print when it is executed? int x = 3, y = 4; if (x = 4) y = 5; else y = 2; printf ("x=%d, y=%d ",x,y);
What is the acronym for ansi?
What does static variable mean in c?
Why can't I perform arithmetic on a void* pointer?
How would you obtain the current time and difference between two times?
explain what is fifo?
Hai sir, I had planned to write the NIC scientific engineer exam , plz post the sample question......
Can an array be an Ivalue?