fork download
  1. #include <stdio.h>
  2.  
  3. struct Point {
  4. int x;
  5. int y;
  6. };
  7. struct Rect {
  8. struct Point lt;
  9. struct Point rb;
  10. };
  11. void transform(struct Rect *r) {
  12. int tmpltx, tmplty, tmprbx, tmprby;
  13. tmpltx = -(*r).rb.x;
  14. tmplty = -(*r).rb.y;
  15. tmprbx = -(*r).lt.x;
  16. tmprby = - (*r).lt.y;
  17. (*r).rb.x = tmprbx;
  18. (*r).rb.y = tmprby;
  19. (*r).lt.x = tmpltx;
  20. (*r).lt.y = tmplty;
  21. return;
  22. }
  23.  
  24. int main () {
  25. struct Rect rect = { {2, 4}, {7,1} };
  26. transform(&rect);
  27. printf("%d %d %d %d\n", rect.lt.x, rect.lt.y, rect.rb.x, rect.rb.y);
  28. return 0;
  29. }
Success #stdin #stdout 0s 2168KB
stdin
Standard input is empty
stdout
-7 -1 -2 -4