I am a beginner at programming in C++, I would like to ask you, what is the algorithm/ way to see what kind of element is the following in a char / string.
For example, if I have
char b[]="Ab 3";
and the index, let's say "i" is
i=2;
this means that on i=3 there is '3'. My question: Does there exist an algorithm, which tells me, if I am on index 2, what type of element is on index 3? In our case an 'int'.
Thank you very much!
The type for any element in a char array will always be char. You can, however, check if the char is a digit with isdigit(ch).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With