The program compile fine, but crashes when is running and shows this : Process terminated with status -1073741819
void reverse(char *str){
char * end1 = str;
char tmp = 'c';
if(str){
while(*end1){
++end1;
}
--end1;
while(str<end1){
tmp=*str;
*str=*end1;
*end1=tmp;
str++;
end1--;
}
}
}
Any idea ?
reverse? Are you sure that the string you're passing is modifiable? I.e. notchar* str = "foo";.using namespace std;? This might have collission withstd::endlandchar* endlend1notendland even if it was, it would mask it due to being a locally declared variable.