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 / vadivel t

In addtion to the answer #5.

printf("%s\n",p2); will print the values from 6th byte to
20th byte.

6th byte to 20th bytes of the memory will contain some
Garbage value. So the output will be a string of garbage
values.


For desired o/p see the ans #5

Is This Answer Correct ?    6 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the keywords in c?

1122


What are qualifiers and modifiers c?

1003


Differentiate between full, complete & perfect binary trees.

1093


How are 16- and 32-bit numbers stored?

1288


How to get string length of given string in c?

1067


What is difference between static and global variable in c?

1046


What does c mean?

1041


Explain what is the general form of a c program?

1092


What is a nested formula?

1151


How can you increase the size of a dynamically allocated array?

1187


what is associativity explain what is the precidence for * and & , * and ++ how the folloing declaration work 1) *&p; 2) *p++;

2640


What is the use of sizeof () in c?

1048


Why c is a mother language?

1033


.find the output of the following program? char*myfunc(char*ptr) { ptr +=3; return (ptr); } int main() { char*x,*y; x="HELLO"; y=myfunc(x); printf("y = %s ",y); return 0; }

2581


What is New modifiers?

1125