Hi folks
I am new to C++
i tried to reverse the characters in an array
#include <iostream>
using namespace std;
int main()
{
char kavi[]={'s','w','o','r','d','\0'};
cout<<kavi<<endl;
cout<<"now reversing the word"<<endl;
int i;
while(kavi[i] != '\0')
{
i++;
}
cout<<"Length is"<<i;
int j;
for(j=10;j>=0;j--)
{
cout<<kavi[i];
}
}
but it gave me a "segmentation fault" error.. can u pls help me and tell me as to where I am going wrong ?
thanks
kb