problem is in 15 and 16th line i am unable to store char into a pointer pointing to a string. the problem is same as given in my book.?do i need to change my compiler dev c++? plz help.
#include<iostream>
#include<conio.h>
using namespace std;
void reverse(char *str)
{
char *end=str;
char *beg=str;
char temp;
while(*end)
{
end++;
}
end--;
while(beg<end)
{
cout<<*beg<<" , "<<*end<<endl;
temp=*beg;
*beg=*end;
*end=temp;
beg++;
end--;
}
cout<<str;
}
int main()
{
char *str="saurabh";
reverse(str);
getch();
return 0;
}