I am trying to reverse this string using the pointers and char but the output I am getting is missing the 2nd character and couldn't find what is the reason. like in below case I am missing the word B.
#include <iostream>
#include <cstring>
#include <string>
using namespace std;
int main()
{
int size = 100;
char oldText[size];
char newText[size];
char *pntr;
pntr = oldText;
cout << "Write the Text: \n";
for (int i=0; i<size; i++)
{
cin.get(pntr,size);
newText[i]=*pntr;
cout << *pntr;
pntr++;
}
cout << "The text backwards is: \n";
for (int i = size; i>=0; i--)
{
pntr--;
cout <<newText[i];
}
cout <<endl;
return 0;
}