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){
Instead of
while(scanf("%f %f", &real, &img) == 2)
try
while(scanf("%f %f%*c", &real, &img) == 2) scanf("%f%*c", &myfloat); // will read a float and all eventual characters after it