ok, so my program is a array size 16 and i filled the array with A-P to output it forward using a for loop, it works. but when i try to output the array in reverse with my second for loop it only outputs B-Q in reverse(QPONMLKJIHGFEDCB), when i need it to output A-P in reverse. it seems that the reverse for loop is ending at 'B' rather then 'A' and starting with 'Q'. i cant figure out how to fix it, and i tried for an hour, please help!
the program is:
#include<iostream>
using namespace std;
int main()
{
const int size=16;
char myarr[size];
int ctr;
char mychr= 'A';
On the last loop of the first for loop, you increment mychr one more time beyond what was printed. So when you start the second loop, it's starting at Q.
You're not actually using the array here. You're just printing out the incremented value of the char variable.