Keep getting error that says: Array type 'char [26]' is not assignable this is in header file: char map [bigRow][bigComlum]; const int bigRow = 26; const int bigComlum = 24; this is in cpp file: map = new char [1]; map[0] = new char [1]; I really don't know how to fix this, my objective is to make a 1x1 grid with the symbol = 'x'. I'm not sure if the header file is correct, pleas help!
Hi ,
You have declared a char array so you cant assign values like :
map = new char [1]; map[0] = new char [1];
That is why you are seeing Error :"
Array type 'char [26]' is not assignable
"
I checked the given code and i found some mistake in terms of coding and the required output you wanted.So here I am posting below code (C++ ) which will create 1* 1 grid with symbol 'X'.
#include <iostream>
using namespace std;
int main()
{
const int bigRow = 26;
const int bigComlum = 24;
char map [bigRow][bigComlum];
//assigning * to char array
for(int i =0;i<bigRow;i++)
{
for(int j=0;j<bigComlum;j++)
{
map[i][j]='*';
}
}
//Printing the pattern
for(int i =0;i<bigRow;i++)
{
for(int j=0;j<bigComlum;j++)
{
cout << map[i][j];
}
cout << "\n";
}
return 0;
}
I hope i make myself clear. Still If i am not clear then please let me know.
Get Answers For Free
Most questions answered within 1 hours.