Creating a string for decimals

To Anyone Who Can Help-

I'm in the midst of typing a code for a program where the user enters a numerical dollar amount as a string and has it convert to word form.
Ex) $67,218.21 becomes Sixty-seven thousand, two hundred eighteen and twenty one hundredth dollars.

For debugging purposes, I've had it print out the string length count with all characters, which it shows. It also gives out an error for things such as sign and magnitude.

The main thing that has been hampering me in my process is the decimal place. I'm trying to get the program to, upon seeing the decimal, take the string values past the right decimal and put them into a separate string, and put NULL values where the old values were. My problem is that it isn't modifying these values; the user entry string remains unchanged, and the decimal string has garbage.

I especially know it doesn't work because I'm trying to have it subtract from the previous length count and add to a decimal length count, and then print out both strings, neither of which the program does. What exactly is it that I'm doing wrong?

You can easily find and truncate the digits on the left hand side of the decimal point, using a while(s[i] != '.' && i++ < len), where "len" is an int variable, with the length of the string:
int len = strlen(s);

For all the rest of it, William, William, William, -- tsk tsk! Our numbers are based on 10 - and every power of 10 gives us a new word: one's, ten's, hundreds, thousands, etc.

If your number is a string, then after removing the decimal point and any digits to the right hand side of that decimal point, then you can simply use strlen(charArrayName), to tell you what word is the proper word to start with:

Note that if you remove the end of string char '\0', along with the decimal point, that you will want to replace it as the right most char in any string. Otherwise, your string is just a gaggle of chars, not a string in C.

So, your code is WAY Rube Goldberg, and using our number base of 10, you can shorten it, using an array of words. We don't use "5 ten thousands" though. So set it up to display "50 thousand", as hinted in the code above.

That will seriously shorten your code, and the time it takes to write it. Thinking cap required.

Thanks for your advice. I'm starting to understand how to take care of the word sorting. However, when I tried to run this sample code in my sandbox to see how it processed, there was literally no output; just two empty rows. There were no errors or warnings on my compiler.