Storing a string in a struct

Started by
2 comments, last by theBegger 9 years, 11 months ago

I'm trying to store a string in a struct. Do I need different call names for the string and the string when it's in the struct? What is the correct syntax for something like this?

Advertisement
I have no clue what you are asking. What language are you talking about? What do you mean by 'call name'?

Are you talking about a c-string (char array) or a c++ string (STL), those are totally different thing. But anyway, you write them pretty much the same way as without a struct:

struct SomeStruct {

char Buffer[256];

};

or

struct SomeStruct {

std::string s;

};

Sorry BitMaster, I thought that since I tagged the language I was covering the bases, but I can elaborate next time!

Thanks vortez that is extremely helpful :)

This topic is closed to new replies.

Advertisement