RicardasSim

array pointer

Jul 5th, 2019
861
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.41 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. void ppr1(int *p)
  6. {
  7.     printf("%p\n",(void*)p);
  8. }
  9.  
  10. void ppr2(int p[])
  11. {
  12.     printf("%p\n",(void*)p);
  13. }
  14.  
  15. int main()
  16. {
  17.  
  18.     int arr[10]={0};
  19.  
  20.     int *pArr;
  21.    
  22.     pArr = arr;
  23.    
  24.     printf("%p %p\n",(void*)arr, (void*)pArr);
  25.  
  26.     ppr1(arr);
  27.    
  28.     ppr2(arr);
  29.  
  30.     ppr1(pArr);
  31.    
  32.     ppr2(pArr);    
  33.    
  34.     return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment