Originally Posted by
yurci
If you do it so, it give a convertion error: char to char*
Symptoms of bigger data structure problems. An array of 1 really isn't an array at all.
Code:
char *gam[3][8]; // This is for storing SCALES, This size for now.
char *sual[7]; // This is my input array for searching
char g[1]; // This cin my NOTE input and assigns it to sual[] array for further.
My turn:
Code:
char *gam[3][8]; // declare gam as array, 3 of array, 8 of pointer to char
char *sual[7] // declare sual as array, 7 of pointer to char
char g[1] // declare g as array, 1 of char
All those pointers need to be pointing at useful addresses, and they make up the elements of a majority of your arrays. It is risky to store literal strings in such an obvious way because the minute you try to write to them, they invoke undefined behavior, because they (the literal strings, as in "G") are stored in read only memory.
Since this is C++ you really ought to make your life easier:
Code:
#include <string>
using std::string;
string gam[3][8];
string sual[7];
string g;
Of course, not that I'm suggesting you ignore C strings forever, lest you be fated to be satisfied with crappy algorithms because of a lack of foundational knowledge. When there are better things out there. In a way, string is C strings, contained. You should take advantage.