Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void exchange(int &a, int &b)
- {
- int temp = a;
- a=b;
- b = temp;
- }
- /*
- int main()
- {
- int a = 10;
- int b = 15;
- exchange(a, b);
- cout<<a<<" "<<b<<endl;
- return 0;
- }
- */
- void reversed(int arr[], int SIZE)
- {
- for (int i = 0; i <= (SIZE/2); i++)
- {
- exchange(arr[i],arr[SIZE - 1 - i])
- ;
- }
- }
- int main()
- {
- int arr[3] = {1, 2, 3};
- reversed(arr, 3);
- for (int i = 0; i<3; i++)
- {
- cout<<arr[i]<<endl;
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment