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 does s c mean on snapchat?
Can you pass an entire structure to functions?
Tell us two differences between new () and malloc ()?
What are the 5 data types?
Should I use symbolic names like true and false for boolean constants, or plain 1 and 0?
differentiate built-in functions and user – defined functions.
In this assignment you are asked to write a multithreaded program to find the duplicates in an array of 10 million integers. The integers are between -5000,000 to 5000,000 and are generated randomly. Use 10 threads, each thread works on 1000,000 integers. Compare the time needed to accomplish the task with single thread of execution program. Do not include the time to fill the array with integers in the execution time.
How many levels of indirection in pointers can you have in a single declaration?
Do you know the difference between malloc() and calloc() function?
How can I read in an object file and jump to locations in it?
swap 2 numbers without using third variable?
Is there any data type in c with variable size?
State the difference between x3 and x[3].
What is this pointer in c plus plus?
What is difference between class and structure?