What Will Be The Output For The Following Codep Pre Langc #1162

What will be the output for the following code?</p> <pre><code class="language-c"> #include <stdio.h> #include <stdlib.h> void combination(int arr[], int aux[], int start, int end, int index, int r); int compare (const void * a, const void * b) { return ( *(int*)a - *(int*)b ); } void print(int arr[], int n, int r) { int aux[r]; qsort (arr, n, sizeof(int), compare); combination(arr, aux, 0, n-1, 0, r); } void combination(int arr[], int aux[], int start, int end, int index, int r) { if (index == r) { for (int i=0; i<r; i++) printf("%d " ,aux[i]); printf(", "); return; } for (int i=start; i<=end && end-i+1 >= r-index; i++) { aux[index] = arr[i]; combination(arr, aux, i+1, end, index+1, r); while (arr[i] == arr[i+1]) i++; } } int main() { int arr[] = {1, 2, 2}; int r = 2; int n = sizeof(arr)/sizeof(arr[0]); print(arr, n, r); }</code></pre>

Online Quiz This multiple choice question (MCQ) is related to the book/course gs gs122 Data Communication and Computer Network. It can also be found in gs gs122 Number Theory - Generating Combinations - Quiz No.2.


Similar question(s) are as followings:



Online Quizzes of gs122 Data Communication and Computer Network

Choose an organization

Theme Customizer

Gaussian Texture



Gradient Background