Advertisement
luizaspan

Pointers II

Jul 2nd, 2015
451
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.26 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. #define n 100
  4.  
  5. int main(void)
  6. {
  7.     int v[100],*p,i;
  8.     float med=0.;
  9.  
  10.     p=v;
  11.  
  12.     for (i=0;i<n;i++)
  13.     {
  14.         *(p+i)=i+1; // TENDEU?
  15.  
  16.         printf("%p \t %d \n",&v[i],v[i]);
  17.  
  18.         med+=v[i];
  19.     }
  20.  
  21.     printf("Média: %.1f \n",med/(i+1));
  22.  
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement