Skip to content

Instantly share code, notes, and snippets.

@ArtyomLazyan
Created April 22, 2017 19:10
Show Gist options
  • Save ArtyomLazyan/4b76a91eb1eb39bc314ebc2d24032b86 to your computer and use it in GitHub Desktop.
Save ArtyomLazyan/4b76a91eb1eb39bc314ebc2d24032b86 to your computer and use it in GitHub Desktop.
ReverseString
/* ********** REVERSE STRING *********** */
#include <iostream>
int main()
{
char str[] = "Hello world";
int i = 0, j = 0;
int size = (int)strlen(str);
for (i = 0, j = size - 1; i < j; i++, j--)
{
char temp = str[i];
str[i] = str[j];
str[j] = temp;
}
std::cout << str << std::endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment