Hey,
I would like to break one char for example "t6" into to chars t and 6
look at what i did...

            int a,b;

            temp = *arraystr[2] % '10';
            a = temp - '0';
            temp = *arraystr[2] / '10';
            b = temp - 'a';

Recommended Answers

This post seems a little nonsensical. "t6" is not a char but a string. What is the type of arraystr? Why are you storing the answer into int's?

Jump to Post

All 2 Replies

This post seems a little nonsensical. "t6" is not a char but a string. What is the type of arraystr? Why are you storing the answer into int's?

As NathanOliver said, "t6" isn't a char, it's a char array. To get 't' and '6', you can simply access them as "t6"[0] and "t6"[1] respectively.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.