Cooler_

num elements in array

Oct 22nd, 2011
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.27 KB | None | 0 0
  1. //   by Cooler_
  2. #include <stdio.h>
  3. #define num_elements(array) (sizeof(array) / sizeof *(array))
  4.  
  5. int main()
  6. {
  7.  int x[] = {1,2,7,0,0,1};
  8.  char *w[] = {"0x0FF","0x0a","0x90","0x80"};
  9.  
  10.  printf("int  %d , strings %d \n",num_elements(x),num_elements(w));
  11.  
  12.  return 0;
  13. }
  14.  
  15.  
Advertisement
Add Comment
Please, Sign In to add comment