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 / vint

int main()
{
char *p1="Name";
char *p2,*s1,*s2;;
p2=(char *)malloc(20);
s1 = p1;
s2 = p2;
while(*p2++ = *p1++);
printf("%s %s",s1,s2);
return 0;
}

Store the Start address of p1 and p2 before incrementing the pointer so that it could be later used to print the String.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write a program to print “hello world” without using semicolon?

1121


Is that possible to add pointers to each other?

1369


What is assert and when would I use it?

1003


given post order,in order construct the corresponding binary tree

2781


Explain main function in c?

1082


Which is better pointer or array?

1024


How can I swap two values without using a temporary?

1103


which of the following is allowed in a "C" arithematic instruction a) [] b) {} c) () d) none of the above

1721


How can I call fortran?

1041


What is scanf () in c?

1126


What is a rvalue?

1203


Why is c so powerful?

1111


What is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?

1115


Why #include is used in c language?

1048


What is dynamic memory allocation?

1335