Advertisement
AntonioVillanueva

sizeof T(*p)[]

Oct 20th, 2017
198
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 <stdlib.h>
  3. #define size(W) sizeof (*W)/sizeof (*W[0])
  4.  
  5. int main (){
  6.   int t [][7]={{1,2,3,4,5,6,7}}; //Array bi original
  7.  
  8.     int (*p)[size(t)] = t; /*la nueva declaracion de arrays */;    
  9.     printf ("size de *p[]= %d \n",size(p));//size desde el puntero
  10.  
  11.   for (int i=0;i<size(p);i++)  {printf ("dato = %d  \n",(*p)[i]);}
  12. return 0;
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement