Reverse string

#include <iostream>
#include <bits/stdc++.h>
using namespace std;

void reverseString(string str){
    int n  = str.length();

    for(int i = n; i >= 0; i--){
        cout <<str[i];
    }
}

int main(){
    string str = "oceanLabz";
    reverseString(str);
    // cout<<str;
    return 0;
}

    Leave a Reply

    Your email address will not be published.

    Need Help?