Hi all!!!
I'm starting to learn C++ on my own and I have a question about accessing a structure through a dynamic array. I've looked into some previous threads that apply to this but they all deal with structure composed of int variables. This concerns char and is driving me nuts.
#include <iostream>
using namespace std;
struct structname
{
char pst[10];
};
int main(void)
{
structname *pointername = new structname[3];
pointername[0].pst = "Mocha";
cout << pointername[0].pst << endl;
delete pointername;
return 0 ;
}
I've attempted these syntaxes but to no avail
structname->membername=
(*structname).membername=
(structname).membername=
all I get is error message about const char* not being able to be converted to char.
Thanks for any help.