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
What would be an example of a structure analogous to structure c?
Differentiate abs() function from fabs() function.
Are pointers integer?
What is file in c preprocessor?
Explain how can I right-justify a string?
how to write optimum code to divide a 50 digit number with a 25 digit number??
Explain main function in c?
Is it possible to pass an entire structure to functions?
Why n++ execute faster than n+1 ?
How is = symbol different from == symbol in c programming?
What is variable declaration and definition in c?
Which of these functions is safer to use : fgets(), gets()? Why?
Is c is a high level language?
c language supports bitwise operations, why a) 'c' language is system oriented b) 'c' language is problem oriented c) 'c' language is middle level language d) all the above
In this assignment you are asked to write a multithreaded program to find the duplicates in an array of 10 million integers. The integers are between -5000,000 to 5000,000 and are generated randomly. Use 10 threads, each thread works on 1000,000 integers. Compare the time needed to accomplish the task with single thread of execution program. Do not include the time to fill the array with integers in the execution time.