fork download
  1. #include <stdio.h>
  2.  
  3. struct s {
  4. int x;
  5. int y;
  6. };
  7.  
  8. int main(void)
  9. {
  10. struct s a = {10, 20};
  11. struct s b = {10, 20};
  12. struct s c = {30, 40};
  13.  
  14. if (a.x == b.x) a.x = c.x;
  15. printf("a.x = %d\n", a.x);
  16.  
  17. a = b;
  18.  
  19. // if (a == b) a = c;
  20. printf("a.y = %d\n", a.y);
  21.  
  22. return 0;
  23. }
Success #stdin #stdout 0.01s 5316KB
stdin
Standard input is empty
stdout
a.x = 30
a.y = 20