#include "stdio.h"
#include "stdlib.h"
#include "math.h"
struct c_comp                                          //define a struct
{
        double rmz;
        double imz;
}c_comp;
void c_comp_product(struct c_comp*,struct c_comp*,struct c_comp*);   //declare a func of complex product
 
 
int main()                                             //main func starts
{
int num;
struct c_comp *a1,*a2,*c;                              //declare pointers
a1=(struct c_comp*)malloc(sizeof(struct c_comp));      //let pointers direct to menory locations
a2=(struct c_comp*)malloc(sizeof(struct c_comp));
c=(struct c_comp*)malloc(sizeof(struct c_comp));
a1->rmz=1.0;a1->imz=1.0;                               //decide the values of each pointer structs
a2->rmz=2.0;a2->imz=2.0;
c_comp_product(a1,a2,c);                               //call func of complex product
return 0;
}                                                      //main func ends
 
 
void c_comp_product(struct c_comp *a1,struct c_comp *a2,struct c_comp *c)  //definition of the func of complex product
{
        double p,q,s;
        if(a1 == NULL || a2 == NULL || c == NULL)
        { printf("(c_comp_product)The c_comp pointer is NULL!\n"); }
        p = a1->rmz*a2->rmz;
        q = a1->imz*a2->imz;
        s = (a1->rmz + a1->imz)*(a2->rmz + a2->imz);
        c->rmz = p - q;
        c->imz = s - p - q;
        printf("hello\n");
        printf("%f %f\n",c->rmz,c->imz);
 
}
 