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 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 …
Jump to PostIt depends on where the data is coming from. If it is coming from an input stream, there should be handling in place for the event of bad input. Even if you treat it all as characters, you'll have to parse numbers out of it anyways (unless you're only keeping …
Jump to PostTrue, but now you've gone from storing int and char to storing char* with the overhead of marking which ones may need to later be converted to integers. No need to overcomplicate things... ;)
Well it depends how complex the OP's project is. We don't know what he/she is doing? …
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.