Question

Keep getting error that says: Array type 'char [26]' is not assignable this is in header...

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!

Homework Answers

Answer #1

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.

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
this is in header file: char map [bigRow][bigComlum]; const int bigRow = 26; const int bigComlum...
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 = new char [1] grid[bigRow][bigComlum] = '^'; Keep getting error that says: Array type 'char [26]' is not assignable. I think the problem is the information in the header file, how can I fix this without using double pointers?
Here is my java code, I keep getting this error and I do not know how...
Here is my java code, I keep getting this error and I do not know how to fix it: PigLatin.java:3: error: class Main is public, should be declared in a file named Main.java public class Main { ^ import java.io.*; public class Main { private static BufferedReader buf = new BufferedReader( new InputStreamReader(System.in)); public static void main(String[] args) throws IOException { String english = getString(); String translated = translate(english); System.out.println(translated); } private static String translate(String s) { String latin =...
I'm not sure how to fix my code I keep getting an error with rhs.begin. I...
I'm not sure how to fix my code I keep getting an error with rhs.begin. I linked the header file and the test file, THESE TWO CANNOT be changed they have absolutely no errors in them. To clarify I ONLY need help with the copy constructor part. /* ~~~~~~~~~~~~list.cpp~~~~~~~~~~~~~~~*/ #include #include "list.h" using namespace std; Node::Node(string element) { data = element; previous = nullptr; next = nullptr; } List::List() { first = nullptr; last = nullptr; } List::List(const List& rhs)//...
C Program Write a program to count the frequency of each alphabet letter (A-Z a-z, total...
C Program Write a program to count the frequency of each alphabet letter (A-Z a-z, total 52 case sensitive) and five special characters (‘.’, ‘,’, ‘:’, ‘;’ and ‘!’) in all the .txt files under a given directory. The program should include a header count.h, alphabetcount.c to count the frequency of alphabet letters; and specialcharcount.c to count the frequency of special characters. Please only add code to where it says //ADDCODEHERE and keep function names the same. I have also...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT