I created a structure as:
typedef struct {
float real, img;
} cmplx;
And I created a function as
void input(cmplx *a) {
scanf("%f + %f i", &a->real, &a->img);
}
and called the function from main as:
cmplx a;
input(&a);
The execution stops when the scanf is reached. If floats are replaced by ints, the problem is solved. What is this behaviour? Is there a way I can use floats for my problem?
The program was compiled in Turbo C, in Windows XP.
It is hard to answer without knowing the error message that your program’s execution stops with, but from your comment “is there any code i can write to tell compiler to link floating point library”,
I suspect it may be this issue:
Using this workaround, or a more modern compiler, will probably fix your issue.