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 |
What is strcpy() function?
main() { int i=1; while (i<=5) { printf("%d",i); if (i>2) goto here; i++; } } fun() { here: printf("PP"); }
write an algorithm and a program to count the number of elements in a circularly singly linked list
write a program wch produces its own source code aas its output?
study the code: #include<stdio.h> void main() { const int a=100; int *p; p=&a; (*p)++; printf("a=%dn(*p)=%dn",a,*p); } What is printed? A)100,101 B)100,100 C)101,101 D)None of the above
Write a programme using structure that create a record of students. The user allow to add a record and delete a record and also show the records in ascending order.
0 Answers Sikkim Manipal University,
ATM machine and railway reservation class/object diagram
What is the purpose of main( ) in c language?
What is volatile variable in c?
Why are algorithms important in c program?
How can a number be converted to a string?
What was noalias and what ever happened to it?