If I were you I would make line 8
const char *bookstr[] = {"Math", "Physics", "Chemistry", "DSP"}
and I would remove the * in line 11:
cout << loop+1 << "." << bookstr[loop] << "\n";
Actually, I would probably stop using c-strings and go over to std::string.
Last edited on
bookstr is an array of char-pointers.
So bookstr[loop] is one char-pointer.
So *bookstr[loop] is what one char-pointer is pointing at.
What kind of object does a char-pointer point at? A char.
So what are you sending to cout? A char.
So what appears on screen? A char.
@lastchance
Thanks for the advise dear.
@ Repeater
Thanks dear..that is exactly the answer I was looking for.