I got run-time error in the following simple code, but I don't know what's the problem. can any one help?
#include "stdafx.h"
#include<iostream>
using namespace std;
void reverse (char * source)
{
int i=0, j=strlen(source)-1;
while (i<j)
{char temp=source[j];
source[j]=source[i];
source[i]=temp;
i++;
j--;
}
cout<<source<<endl;
}
void main()
{
reverse("university");
}