[ create a new paste ] login | about

Link: http://codepad.org/j7GOwAc5    [ raw code | output | fork ]

C++, pasted on Jan 14:
#include <iostream>

using namespace std;

void myreverse(char * des, char * src)
{
	int n = strlen(src);
	*(des + n) = '\0';
	for (int i = 0; i < n; i++)
	{
		*(des + i) = *(src + n - i - 1);
	}
}

int main()
{
	char * source = new char[100];
	char * result = new char[100];
	//cin >> source;
char str[] = "hello world!";
source = str;
	myreverse(result, source);
	cout << result;
}


Output:
1
!dlrow olleh


Create a new paste based on this one


Comments: