If I input 5 5 at the terminal, press enter, and press enter again, I want to exit out of the loop.
5 5
int readCoefficents(double complex *c){
Use fgets to read console input:
int res = 2; while (res == 2) { char buf[100]; fgets(buf, sizeof(buf), stdin); res = sscanf(buf, "%f %f", &real, &img); if (res == 2) c[i++] = real + img * I; } c[i++] = 1 + 0*I; // most significant coefficient is assumed to be 1 return i;