returning an appropriate string for an expected int value ??
Hi can anyone help?
Im trying to write a single function which sets a small array with 2 characters to the ordinal suffix of a number. 1st, 2nd, 3rd 4th etc
and the suffix refers to the laters.
my function prototype is
void suffix(int n, char suff);
and i have made the following declarations
and with the result of the call
will give the appropriate string in s for any given positive value of x from 0 to 9999
a possible pattern i have found is that 4 - 20 end in th
then the first three after that have st,nd,rd
is there a command that can read the last digit of an integer number ?
because if there is then i can use conditions easier and compare the last digit against the tests to see what its suffix ( letters ) are.
any help much appreciated.