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
Why doesnt this code work?
code for find determinent of amatrix
why programs in c are running with out #include
What does void main return?
What is the symbol indicated the c-preprocessor?
What are dangling pointers in c?
Find duplicates in a file containing 6 digit number (like uid) in O (n) time.
Is c compiled or interpreted?
What are the types of functions in c?
explain what are actual arguments?
Explain what is the difference between text files and binary files?
What is equivalent to ++i+++j?
What is realloc in c?
Is c++ based on c?
Given an array of 1s and 0s arrange the 1s together and 0s together in a single scan of the array. Optimize the boundary conditions?