fork download
  1. #include "stdio.h"
  2. #include "stdlib.h"
  3. #include "math.h"
  4.  
  5. void main() //+++++++++++++++
  6. {
  7. struct c_comp{
  8. double rmz;
  9. double imz;
  10. }c_comp;
  11. int c_comp_product(a1,a2,c)
  12. struct c_comp *a1,*a2,*c;
  13. {
  14. double p,q,s;
  15. if(a1 == NULL || a2 == NULL || c == NULL)
  16. {
  17. printf("(c_comp_product)The c_comp pointer is NULL!\n");
  18. return(0);
  19. }
  20. a1->rmz=1;a1->imz=1; //+++++++++++++
  21. a2->rmz=2;a2->imz=2; //+++++++++++++
  22. p = a1->rmz*a2->rmz;
  23. q = a1->imz*a2->imz;
  24. s = (a1->rmz + a1->imz)*(a2->rmz + a2->imz);
  25. c->rmz = p - q;
  26. c->imz = s - p - q;
  27. printf("%f %f\n",c->rmz,c->imz); //++++++++++++
  28. return(1);
  29. }
  30. }
  31.  
Runtime error #stdin #stdout 0s 1784KB
stdin
Standard input is empty
stdout
Standard output is empty