Changing only x8 does not change the a array. You need to change the location in the array of the x8 value.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
// test.cpp : main project file.
#include <iostream>
usingnamespace std;
int main()
{
char x1='a',x2='a',x3='a',x4='a',x5='a',x6='a',x7='a',x8='a';
char a[]={x1, x2, x3, x4, x5, x6, x7, x8 ,'\0'};
cout << a << endl;
a[7]='b'; // Changed the value of a[7] only. x8 still equals 'a'
cout << a << endl; // I WANT a TO BECOME aaaaaaab.
return 0;
}