box-o-sand/gowrikumar/00-sizeof.c

24 lines
357 B
C
Raw Normal View History

2011-06-13 02:36:31 +00:00
#include <stdio.h>
2011-06-13 03:02:18 +00:00
int array[] = {23, 34, 12, 17, 204, 99, 16};
#define TOTAL_ELEMENTS sizeof(array) / sizeof(array[0])
2011-06-13 02:36:31 +00:00
int main()
{
int d;
2011-06-13 03:02:18 +00:00
#ifdef DEBUG
printf("sizeof(array) = %d\n", TOTAL_ELEMENTS);
#endif
for (d = 0; d < TOTAL_ELEMENTS ; d++)
printf("%d\n", array[d]);
2011-06-13 02:36:31 +00:00
return 0;
}
/* vim:filetype=c:fileencoding=utf-8
*/