Ok so I read that you can mix data types, however I'm not sure if this is something that's used all the time, or if it's something that should be avoided if possible. Thanks!
when you mix data types in calculations. for example when you divide a float value like 15.5 by an integer such as 5 C++ will attempt to automatically hanle the mixing of the two, its called promotion. when one data type of a variable is temporarily converted to match the data type of another variable so that a math operation can be performed using the mixed data type. (definition off of google somewhere)
OHH, well that would have cleared it up. Yeah there's really nothing wrong with that. As long as you aren't making some messed up conversions (like char-int). Mixing around floating points with integers is perfectly fine.
Well it's just kind of strange to convert from char to int. If you have reason then it makes sense but I'd say this code is rather odd.
1 2 3
char first = 'a';
int second = 3;
int third = first + second
Inherently the types are identical but in terms of purpose they are decidedly not, which is why I dislike the idea. But really there's no mechanical issue with it.