Question
write the following functions in a C program not C++. 1. complex complex_add(complex, complex); complex_add() will add the corresponding fields of two complex variables together
write the following functions in a C program not C++.
1. complex complex_add(complex, complex);
complex_add() will add the corresponding fields of two complex variables together and will return a complex value that represents the sum. For instance, if complex_add() is invoked with the values (1.0, 2.0) and (3.0, 4.0), it will return the value (4.0, 6.0). complex complex_neg(complex);
2. complex_ neg() will return the negative form of the argument. E.g., -1.0 times the value of each field.
complex complex_sub(complex, complex);
3. complex_ sub() is similar to complex_add() except that it subtracts the second argument from the first. You should implement this function with something like: complex_add(arg1, complex_neg(arg2))
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started