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



what will the following program do? void main() { ..

Answer / abhiraj

a = malloc....


this sentence will give the error Lvalue required..

Is This Answer Correct ?    11 Yes 0 No

Post New Answer

More C Interview Questions

What is the purpose of & in scanf?

0 Answers  


How are portions of a program disabled in demo versions?

0 Answers  


I need a help with a program: Write a C program that uses data input in determining the whole of points A and a whole of circles B. Find two points in A so that the line which passes through them, cut through the maximum number of circles.

0 Answers   TCS,


plz answer.. a program that takes a string e.g. "345" and returns integer 345

4 Answers  


struct node {struct node*temp,*new} prinf("%d",sizeof(struct node));

2 Answers  






What is an array in c?

0 Answers  


When a c file is executed there are many files that are automatically opened what are they files?

0 Answers  


What is define c?

0 Answers  


what different between c and c++

1 Answers  


What is the purpose of the statement: strcat (S2, S1)?

0 Answers  


How will you delete a node in DLL?

0 Answers   GrapeCity,


Which is best linux os?

0 Answers  


Categories