test data;
data.readdata();
data.revarray();
data.writedata();
return 0;
}
the problem in this code is i want to read from a atc.text file as
kamal
Manav
Abhishek
united
//then reverse the readen data like
lamak
vanam
kehsihbA
detinu
then write these lines in text2 file..
i found the output by this code in atc2 file like lamakIIIIIIIyyyyyyy this type and some garbage...
While reversing the array from a to b the character locations of array b are incorrectly calculated and all 200 char of array are being dumped into the output file.
For example: In void test::revarray() function.
when len = 5 : i = 4 & the index of array b will be [( 5 - 4 ) - 4], this would return the negative number (-3) which is incorrect.