fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. struct Complexo {
  5. int real;
  6. int imaginario;
  7. };
  8.  
  9. struct Complexo insereComplexo(int r, int i){
  10. struct Complexo novo;
  11. novo.real = r;
  12. novo.imaginario = i;
  13. return novo;
  14. }
  15.  
  16. void somaComplexo(struct Complexo *a, struct Complexo b){
  17. a->real += b.real;
  18. a->imaginario += b.imaginario;
  19. }
  20.  
  21. int main(int argc, char *argv[]){
  22. struct Complexo a, b;
  23. a = insereComplexo(4,7);
  24. b = insereComplexo(8,10);
  25. somaComplexo(&a, b);
  26. printf("%d\n", a.real);
  27. printf("%d\n", a.imaginario);
  28. system("pause");
  29. }
  30.  
  31. //https://pt.stackoverflow.com/q/303412/101
Success #stdin #stdout #stderr 0s 4188KB
stdin
Standard input is empty
stdout
12
17
stderr
sh: 1: pause: not found