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 / abhiraj
a = malloc....
this sentence will give the error Lvalue required..
| Is This Answer Correct ? | 11 Yes | 0 No |
The % symbol has a special use in a printf statement. Explain how would you place this character as part of the output on the screen?
Explain what is a pragma?
difference between c and c++?
What are categories used for in c?
What is sorting in c plus plus?
What do you mean by Recursion Function?
what is the difference between #include<> and #include”…”?
What's wrong with "char *p; *p = malloc(10);"?
write a program to copy the string using switch case?
How can variables be characterized?
Write a program in c to print * * * * * *******
what is the use of ‘auto’ keyword?