Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

How many types of functions are there in c?

1140


How can I dynamically allocate arrays?

1097


printf(), scanf() these are a) library functions b) userdefined functions c) system functions d) they are not functions

1156


Is register a keyword in c?

1040


a c variable cannot start with a) an alphabet b) a number c) a special symbol d) both b and c above

1223


What does 2n 4c mean?

1231


find the value of y y = 1.5x+3 for x<=2 y = 2x+5 for x>2

1990


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);

1879


What is the acronym for ansi?

1047


What does static variable mean in c?

1101


Why can't I perform arithmetic on a void* pointer?

1096


How would you obtain the current time and difference between two times?

1288


explain what is fifo?

1069


Hai sir, I had planned to write the NIC scientific engineer exam , plz post the sample question......

2187


Can an array be an Ivalue?

1092