In my piece of code, I have tried changing it from '' to '\0' as this is usually how you insert a blank character into an array but for some reason, it doesn't give me the expected output when trying this and I'm unsure why.
Output I am expecting is this:
#########
#######
####
##
What I'm actually getting is this:
########
#include <iostream>
using namespace std;
int main (){
char myArray[8] = {'#', '#', '#', '#', '#', '#', '#', '#'};
cout << myArray << endl;
int i = 0;
while (i < 3){
myArray[0+i] = '\0';
myArray[7-i] = '\0';
cout << myArray << endl;
i++;
}
return 0;
}