0

C program for Complex number addition,subtraction,multiplication and division it can be done only in structure ???

Say me any of the sololearners..

9th Oct 2018, 11:39 AM
Dhiviya Thirumavalavan
Dhiviya Thirumavalavan - avatar
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) { /*...*/ }
9th Oct 2018, 1:30 PM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar
0
Kinshuk Vasisht Thanks a lot my friend😊
9th Oct 2018, 1:34 PM
Dhiviya Thirumavalavan
Dhiviya Thirumavalavan - avatar