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?
Please find the answer below.
Please do comments in case of any issue. Also, don't forget to rate
the question. Thank You So Much.
There is no need to allocate memory in cpp file because it is declared with pre allocated memory.
header.h
#ifndef HEADER_H_
#define HEADER_H_
const int bigRow = 26;
const int bigComlum = 24;
char map [bigRow][bigComlum];
#endif /* HEADER_H_ */
main.cpp
#include <iostream>
#include "header.h"
using namespace std;
int main () {
map[bigRow][bigComlum] = '^';
cout<<map[bigRow][bigComlum];
return 0;
}
output
Get Answers For Free
Most questions answered within 1 hours.