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 is a program flowchart and explain how does it help in writing a program?

1312


When should the volatile modifier be used?

1184


how should functions be apportioned among source files?

1103


What are the different data types in C?

1205


What is this infamous null pointer, anyway?

1061


Differentiate fundamental data types and derived data types in C.

1036


what is a constant pointer in C

1182


the question is that what you have been doing all these periods (one year gap)

2089


What is a function in c?

1583


Explain enumerated types.

1037


What's a good way to check for "close enough" floating-point equality?

1166


What is break in c?

1048


Why clrscr is used after variable declaration?

1693


What is c language in simple words?

1068


Can you please explain the scope of static variables?

1063