|
|
p_candy[0].brand = "japp";
, which attempts to assign an array of 5 const char (four letters and a null char) to the array of 20 char cannot be compiled.lilysfather wrote: |
---|
But i cant assaign it like that.guess i have to read the Array chapter again to understand why. Edit: Figured it out myself. Should have used something like strcpy(p_candy[0].brand , "japp"); right? |
std::string
class has an overloaded assignment operator, which essentially has code that copies chars individually from one object to the other.printf
instead of cout
, or processing things individually when there is an algorithm that does it for you.std::string
has lots of very handy things, as does all of the STL.