What will be the output of the following program?

		
					

Loading

โœช Choose the correct option.

What will be the output of the following program?

#include  
struct Crackexams {
int arr[5];
public:
void TryFunction(void);
void Display(void);
};
void Crackexams::Display(void) {
for(int i = 0; i < 5; i++) {
cout<< arr[i] << " " ;
}
}
void Crackexams::TryFunction(void) {
static int i = 0, j = 4;
int tmp = arr[i];
arr[i] = arr[j];
arr[j] = tmp ;
i++;
j--;
if(j != i) {
TryFunction();
}
}
int main() {
Crackexams objTry = {{ 5, 6, 3, 9, 0 }};
objTry.TryFunction();
objTry.Display();
return 0;
}

A. 0 9 3 6 5
B. 9 3 6 5 0
C. 5 6 3 9 0
D. 5 9 3 6 0

Leave a Comment