Advertisement
AntonioVillanueva

Test sizeof

Sep 29th, 2016
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.54 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. #define TAM 1
  5. void f(int(*)[TAM]);
  6.  
  7. void f(int (*x)[TAM])
  8. {
  9.     printf ("funcion x= %d \n",x);
  10.     printf (" funcion *(&x+1)= %d \n",*(x + 1));
  11.     printf ("size en funcion  =%d \n", (size_t) (*(x + 1)) - (size_t) x);
  12. };
  13.  
  14. int main()
  15. {
  16.     int  array[] = {1};
  17.    printf ("Main array= %d \n",array);
  18.    printf (" Main *(&x+1)= %d \n",*(&array + 1));    
  19.    
  20.    printf ("size en Main =%d \n", ( (size_t) *(&array + 1) - (size_t) array ));
  21.    
  22.    printf ("\n \n");
  23.    f(&array);
  24.  
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement