StreetGT

Untitled

Nov 15th, 2015
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.46 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. /**
  5. - Ler 2 ints e imprimir divisão em float com notação de apontadores
  6. **/
  7.  
  8. float* divisao(int* px,int* py);
  9. int main()
  10. {
  11.     int x=0,y=0;
  12.  
  13.     printf("x= ");
  14.     scanf("%d",&x);
  15.     printf("\ny= ");
  16.     scanf("%d",&y);
  17.  
  18.     float* pres = NULL;
  19.     pres = divisao(&x,&y);
  20.  
  21.     printf("%p",pres);
  22.  
  23.     return 0;
  24. }
  25.  
  26. float* divisao(int* px,int* py){
  27.     float r = (float) *px / *py;
  28.     return &r;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment