Dear Sirs
Here I am again!.
I need to write a function by using signature below.
void suffix(int n, char suff[]);

And I need to use following declarations:
char s[5];
int x;

the result of a call should be :
suffix(x,s);
will return an appropriate string in s for any given positive value of x from 0 to 9999.

Some sample values for x and the expected value of s are:
1 2 3 4 100 101 102
st nd rd th th st nd

I need help to write this function.
I would be very happy if I could get any single help.
Regards

Think also about "teen-th" sufficies. To get two last decimal digits of the number use n%100 exptression. Read about if and switch statements and strcpy library function...
and no problems...

Be a part of the DaniWeb community

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