0
C program for Complex number addition,subtraction,multiplication and division it can be done only in structure ???
Say me any of the sololearners..
2 ответов
+ 1
It can be implemented without structures, but passing two floating point variables for every complex number you use in the calls to one of the functions for the operations can be tedious. And you can't return the number in a single function then. You will need to use pointers for the results.
Eg :
void add(double real1, double imag1, double real2, double imag2, double* real3, double* imag3) { /*...*/ }
vs
typedef struct { double real,imag } complex;
void add(complex c1, complex c2, complex* c3) { /*...*/ }
or
complex add(complex c1, complex c2) { /*...*/ }
0
Kinshuk Vasisht
Thanks a lot my friend😊