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


Please Help Members By Posting Answers For Below Questions

what is the differnce between programing langauge and tool? is sas is a programing langauge r tool?

1897


What are the applications of c language?

621


How can I invoke another program (a standalone executable, or an operating system command) from within a c program?

653


Explain what does the format %10.2 mean when included in a printf statement?

773


In c programming language, how many parameters can be passed to a function ?

626






Write a program in "C" to calculate the root of a quadratic equation ax^2+bx+c=0, where the value of a,b & c are known.

1718


explain what are pointers?

615


write a program that types this pattern: 12345678987654321 12345678 87654321 1234567 7654321 123456 654321 12345 54321 1234 4321 123 321 12 21 1 1

3276


Wt are the Buses in C Language

2749


What is size of union in c?

578


Whats s or c mean?

591


How can a program be made to print the name of a source file where an error occurs?

725


How do you list files in a directory?

559


Write a program to use switch statement.

654


Explain what is the difference between the expression '++a' and 'a++'?

623