What Will Be The Output Of The Following Codep Pre Langc #408

What will be the output of the following code?</p> <pre><code class="language-c"> #include <bits/stdc++.h> using namespace std; void func(int a[], int n, int k) { if (k <= n) { for (int i = 0; i < k/2; i++) swap(a[i], a[k-i-1]); } } int main() { int a[] = {1, 2, 3, 4, 5}; int n = sizeof(a) / sizeof(int), k = 3; func(a, n, k); for (int i = 0; i < n; ++i) cout << a[i]<<" "; return 0; } </code></pre>

Online Quiz This multiple choice question (MCQ) is related to the book/course gs gs121 Data Structures and Algorithms. It can also be found in gs gs121 Array Types - Reversal Array Operation - Quiz No.1.


Similar question(s) are as followings:



Online Quizzes of gs121 Data Structures and Algorithms

Choose an organization

Theme Customizer

Gaussian Texture



Gradient Background