Is there any way to store characters AND integers into an array?
Matt Tacular
0
Unverified User
Recommended Answers
Jump to PostNo just store them as characters, then if need be convert them to ints.
Jump to PostNot in a simple way. Because things are strongly typed in C/C++, you need to have a single type that can hold your data. You could do something along the lines of this though (pseudocode):
class Data {}; class Int : Data {public: int i}; class Char …
Jump to PostNo just store them as characters, then if need be convert them to ints.
I'd go the other way (int to char) so you don't lose data if the int value is >= 256...
Jump to PostI'd go the other way (int to char) so you don't lose data if the int value is >= 256...
Nah store them as chars, I always do. ints are unsafe. If the user doesn't type in an int where the program expects an int, it crashes, whereas with chars …
All 14 Replies
iamthwee
Infarction
503
Posting Virtuoso
Infarction
503
Posting Virtuoso
iamthwee
Ene Uran
638
Posting Virtuoso
Infarction
503
Posting Virtuoso
WaltP
2,905
Posting Sage w/ dash of thyme
Team Colleague
Matt Tacular
0
Unverified User
iamthwee
Infarction
503
Posting Virtuoso
iamthwee
Infarction
503
Posting Virtuoso
sneekula
969
Nearly a Posting Maven
~s.o.s~
2,560
Failure as a human
Team Colleague
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.