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

Answer Posted / subbu[iit kgp]

the given program gives some meaningless output, with some
modification to the given program as


#include<stdio.h>
#include<stdlib.h>
main()
{
char a[]="ramesh";
char *p1="Name";
char *p2=a;

while(*p2++=*p1++);/*copies contents of p1 to
p2*//* here it is not possible to use while(*a++=*p1++)
because a can not change its value*/
*p2='\0';
printf("%s\n",a);

}

The output will be Name

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the advantages of using macro in c language?

1195


Where in memory are my variables stored?

1249


Explain what is the difference between null and nul?

1215


What is your stream meaning?

1337


What is the difference between malloc calloc and realloc in c?

1190


What is the use of linkage in c language?

1103


What is the explanation for prototype function in c?

1035


Compare interpreters and compilers.

1115


Why dont c comments nest?

1112


Is fortran still used in 2018?

1097


Explain how do you view the path?

1224


Explain high-order bytes.

1181


How many levels deep can include files be nested?

1187


which of the following statement is wrong a) mes=123.56; b) con='T'*'A'; c) this='T'*20; d) 3+a=b;

3336


Explain why C language is procedural?

1276