Search:

Type: Posts; User: MK27

Search: Search took 0.06 seconds.

  1. Thread: populating arrays

    by MK27
    Replies
    12
    Views
    13,916

    Do you want to use an error msg at all? Anyway,...

    Do you want to use an error msg at all? Anyway, if not, you could just take that part out, and simplify by setting "value" to -1 initially. Then, if scanf() doesn't get a proper number, value will...
  2. Thread: populating arrays

    by MK27
    Replies
    12
    Views
    13,916

    Yeah, and using scanf() is fine too. But you...

    Yeah, and using scanf() is fine too. But you need to use the return value of scanf to determine whether or not it retrieved a number. Then you can check that, and do what I did to repeat if scanf()...
  3. Thread: populating arrays

    by MK27
    Replies
    12
    Views
    13,916

    Here's an example: #include ...

    Here's an example:


    #include <stdio.h>
    #include <errno.h>
    #include <stdlib.h>

    /* compile -std=c99 */

    float getInput() {
Results 1 to 3 of 3