#include <iostream>
using namespace std;

void printArray(int arr[], int size){
    cout << "Printing Array --> " << endl;
    for(int i=0; i<10; i++){
        cout << arr[i] << " ";
    }
    cout << endl << endl;
}

int main() {
    int array[10] = {10, 20, 30, 40, 50, 60, 70, 80, 90, 100};
    printArray(array, 10);
    
    for(int i=0; i<10; i+=2){
        if(i+1 < 10){
            swap(array[i], array[i+1]);        
        }
    }
    printArray(array, 10);
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: