I am trying to access an element of an array through the array of pointers. First, I declare my main array with chars and the array of pointers, which will also contain names of other similar arrays:
char listSubjects[3][15] = {
"sports", "movies", "fashion"
};
char* listPointers[1] = {
listSubjects[3]
};
Now I am trying to print that "sports" from the first array (listNum
here is zero):
bub1->writeStr(listPointers[listNum][0]);
I am getting this error:
invalid conversion from 'char' to 'char*'
Getting stuck. I am fairly new to pointers and don't quite understand what I am doing wrong
I also tried using star when I am trying to access an element. It compiled, but I didn't see any text on a screen. Not sure what value it even tries to output, in my program I just see a blank string
bub1->writeStr(*listPointers[listNum][0]);