return the ordinal suffix of a number */
| 622 | |
| 623 | /* return the ordinal suffix of a number */ |
| 624 | const char * |
| 625 | ordin(int n) /* note: should be non-negative */ |
| 626 | { |
| 627 | int dd = n % 10; |
| 628 | |
| 629 | return (dd == 0 || dd > 3 || (n % 100) / 10 == 1) ? "th" |
| 630 | : (dd == 1) ? "st" : (dd == 2) ? "nd" : "rd"; |
| 631 | } |
| 632 | |
| 633 | DISABLE_WARNING_FORMAT_NONLITERAL /* one compiler complains about |
| 634 | result of ?: for format string */ |
no outgoing calls
no test coverage detected