What will the following program do?

			  		

Loading

โœช Choose the correct option.

What will the following program do?


#include
#include
#include
int 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);
return 0;
}

Chose correct option

A. Swap contents of p and a and print
B. Generate compilation error in line number 8
C. Generate compilation error in line number 5
D. Generate compilation error in line number 7

Leave a Comment