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

int *
get_ints (int         argc,
          char      **argv,
          int         n,
          const char *prompt)
{
    int *ret = malloc (sizeof (int) * n);

    if (argc != (n + 1))
    {
        for (int i = 0; i < n; i++)
        {
            printf ("%s: ", prompt);
            scanf ("%d", &ret[i]);
        }
    }
    else
    {
        for (int i = 0; i < n; i++)
            sscanf (argv[i + 1], "%d", &ret[i]);
    }
    
    return ret;
}