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
a sequence of bytes with one to one corrspondence to those in the external device a) sequential addressing b) address c) byte code d) none
What is huge pointer in c?
Explain union. What are its advantages?
Why is python slower than c?
What is c value paradox explain?
Apart from dennis ritchie who the other person who contributed in design of c language.
What are the types of c language?
what is the c source code for the below output? 10 10 10 10 10 10 10 10 10 10 9 9 7 6 6 6 6 6 6 9 7 5 9 7 3 2 2 5 9 7 3 1 5 9 7 3 5 9 7 4 4 4 4 5 9 7 8 8 8 8 8 8 8 8 9
in multiple branching construct "default" case is a) optional b) compulsarily c) it is not include in this construct d) none of the above
How can I read in an object file and jump to locations in it?
write a program to rearrange the array such way that all even elements should come first and next come odd
How do I create a directory? How do I remove a directory (and its contents)?
Write a program to find factorial of a number using recursive function.
What's the right way to use errno?
how to construct a simulator keeping the logical boolean gates in c