









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!










implementation interface
manufacturer’s responsibility client client client use
Complex c1, c2, c3;
struct complex { double real, imag; } typedef struct complex Complex;
c1 = create_complex(2, 3); /* conceptually, c1 = 2+3i */
c3 = add_complex(c1, c2); /* conceptually, c3 = c1 + c2 */
Complex add_complex(Complex c1, Complex c2); { Complex csum; csum.real = c1.real + c2.real; csum.imag = c1.imag + c2.imag; return csum; }
int main() { Complex c1, c2, c3; c1 = create_complex(2, -3); c2 = create_complex(2, 9); c3 = add_complex(c1, c2); print_complex(c3); return 0; } /* Implementation of Complex functions */ :