Your for loop should probably be:
for (n=0; n < num_length; n++)
Suppose your string is 10 characters. Then the ten characters are number[0], number[1], ..., number[9]
For printing dashes in...
Type: Posts; User: c99tutorial
Your for loop should probably be:
for (n=0; n < num_length; n++)
Suppose your string is 10 characters. Then the ten characters are number[0], number[1], ..., number[9]
For printing dashes in...
You should probably use a for loop. For example if your str is "12345" then you could do something like
for (int i=0; i < 5; i++) {
switch(str[i]) {
...
}
}
If you read in the number as a string str, then the digit '2' is located at str[0].
switch(str[0]) {
case '1': printf("one");
break;
case '2': printf("two");
break;
...