Which data type should be used in c++ to store address because address consists of both integers and characters
-
You basically answered your own question. If you need to save something that is a mixture of numbers and characters, I see two obvious choices:
You just need it as a text: I would go with a simple std::string
You need the individual elements (e.g. street name, street number): define a custom struct, e.g.
struct Address { std::string street_name; int house_number = -1; };
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login


ue