Advertisement
fellpz

Distancia de dois pontos (struct e macro)

Apr 6th, 2017
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.37 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #define DIST(a,b) (a+b)/2
  4.  
  5. struct ponto
  6. {
  7. int x;
  8. int y;
  9. };
  10.  
  11. main (void)
  12. {
  13. struct ponto posicao;
  14. //posicao.x=10;
  15. //posicao.y=22;
  16. printf("Posicao de x: %d", posicao.x=10);
  17. printf("\nPosicao de y: %d\n", posicao.y=22);
  18. //DIST(posicao.x,posicao.y);
  19. printf("\nDistancia entre x e y: %d\n", DIST(posicao.x,posicao.y));
  20. return 0;
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement