If you want to print out the last two char's in a string of numbers:
Code:
char n1, n2;
char str[] = {"130"];
n1 = str[strlen(str)-1]; //if you have removed the newline char from the string
n1 = str[strlen(str)-2]; //if you have not removed the newline char from the string str.
//same thing for n2, just subtract one more than you did for n1 to be correct
// if it's in a number, then:
int n1, n2, number = 130;
n1 = number % 10; //gets the right most digit from "number" (the 0)
number /= 10; //divide number by 10
n2 = number % 10; //gets the new right most digit from "number" (the 3)