Search:

Type: Posts; User: c99tutorial

Search: Search took 0.02 seconds.

  1. Replies
    6
    Views
    1,523

    Your for loop should probably be: for (n=0; n...

    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...
  2. Replies
    6
    Views
    1,523

    You should probably use a for loop. For example...

    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]) {
    ...
    }
    }
  3. Replies
    6
    Views
    1,523

    If you read in the number as a string str, then...

    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;
    ...
Results 1 to 3 of 3