Advertisement
math230

array size determination-short

Sep 16th, 2015
563
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<stdio.h>
  2. //example of array size determination:  sizeof(list) will NOT work by itself
  3. int main()
  4. {
  5.   int i=0;
  6.   char name[] = "cool";
  7.   int list[] = {1,2,3,4,5,6,7,8};
  8.  
  9.   printf("The size of the array is %d \n", sizeof(list)/sizeof(int)  );
  10.   printf("The size of the array is %d", sizeof(name)/sizeof(char)  );
  11.  
  12.   return 0;
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement