Vidyalelo
C++ Programming · Q77

Standard Template Library (STL) in C++

Programming · C++ Programming · question 77

Q77

What will be the output of the following C++ code? #include #include int compareints (const void * a, const void * b) return ( *(int*)a - *(int*)b ); int values[] = 50, 20, 60, 40, 10, 30 ; int main () int * p; int key = 40; qsort(values, 6, sizeof (int), compareints); p = (int*) bsearch (&key, values, 6, sizeof (int), compareints); if (p != NULL) printf ("%d ",*p); return 0;

A.
10
B.
20
C.
40
Answer
D.
30

Answer: Option C

Solution

Answer: Option C
No explanation is given for this question Let's Discuss on Board