A simple solution is to read an int with scanf and use its failure to indicate the end of input, so the user could type STOP or just x or anything that isn't whitespace or an int to end input.
Your compare function has a bug as it is possible that a - b will underflow, e.g., if a is -2000000000 and b is 2000000000 then the answer (-4000000000) can't be represented in an int (I'm assuming a 32-bit int here; if they are 64 then the same problem occurs with the squares of those numbers).
Code:
#include <stdio.h>
#include <stdlib.h>
#define MAX_SIZE 100
int intcmp(const void *a, const void *b)
{
int na = *(int*)a, nb = *(int*)b;
return (na > nb) - (na < nb);
}
int main()
{
int values[MAX_SIZE];
int size = 0;
for (int n; size < MAX_SIZE && scanf("%d", &n) == 1; )
values[size++] = n;
for (int ch; (ch = getchar()) != '\n' && ch != EOF; )
;
qsort(values, size, sizeof values[0], intcmp);
for (int i = 0; i < size; ++i)
printf("%d%c", values[i], i < size - 1 ? ',' : '\n');
}
Code:
6 3 123 7646 2000000000 -211 37 -2000000000 75432 -101010 x
-2000000000,-101010,-211,3,6,37,123,7646,75432,2000000000