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...

what will the following program do?
void main()
{
int i;
char a[]="String";
char *p="New Sring";
char *Temp;
Temp=a;
a=malloc(strlen(p) + 1);
strcpy(a,p);
//Line no:9//
p = malloc(strlen(Temp) + 1);
strcpy(p,Temp);
printf("(%s, %s)",a,p);
free(p);
free(a);
}
//Line no 15//

a) Swap contents of p & a and print:(New string, string)
b) Generate compilation error in line number 8
c) Generate compilation error in line number 5
d) Generate compilation error in line number 7
e) Generate compilation error in line number 1

Answer Posted / abhiraj

a = malloc....


this sentence will give the error Lvalue required..

Is This Answer Correct ?    11 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a scope resolution operator in c?

1277


write a c program for swapping two strings using pointer

2633


How can you pass an array to a function by value?

1125


Explain how do you sort filenames in a directory?

1042


Can you please explain the scope of static variables?

1061


What is function definition in c?

1077


Explain how are 16- and 32-bit numbers stored?

1271


What would happen to X in this expression: X += 15; (assuming the value of X is 5)

1952


Explain what is the use of a semicolon (;) at the end of every program statement?

1229


What is the size of a union variable?

1053


Why is c used in embedded systems?

1123


Write a program to print ASCII code for a given digit.

1095


how we can make 3d venturing graphics on outer interface

4832


Can a pointer be volatile in c?

990


Which control loop is recommended if you have to execute set of statements for fixed number of times?

1348