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

Why is struct padding needed?

1156


number of times a digit is present in a number

2079


What is the difference between typedef struct and struct?

1164


Why is c so popular?

1208


What is a #include preprocessor?

1220


The process of repeatedly running a set of computer instructions until some condition is specifed a) condition b) sequential condition c) global d) iteration

1154


What is structure in c explain with example?

1213


What is the scope of static variable in c?

1078


Explain what is a program flowchart and explain how does it help in writing a program?

1142


What is the use of extern in c?

1144


What are the different types of control structures?

1082


How do you declare a variable that will hold string values?

1230


What's the best way of making my program efficient?

1151


Can a pointer be static?

1127


Explain the array representation of a binary tree in C.

1279