diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ef38af9 --- /dev/null +++ b/Makefile @@ -0,0 +1,9 @@ +DEBUG := +export DEBUG + + +all: + cd gowrikumar && $(MAKE) + + +.PHONY: all diff --git a/gowrikumar/00-sizeof.c b/gowrikumar/00-sizeof.c index 9156974..8981bfe 100644 --- a/gowrikumar/00-sizeof.c +++ b/gowrikumar/00-sizeof.c @@ -1,18 +1,20 @@ -/** - * :author: Dan Buch (daniel.buch@gmail.com) - */ - #include -#define TOTAL_ELEMENTS (sizeof(array) / sizeof(array[0])) -int array[] = {23,34,12,17,204,99,16}; + +int array[] = {23, 34, 12, 17, 204, 99, 16}; +#define TOTAL_ELEMENTS sizeof(array) / sizeof(array[0]) + int main() { int d; - for(d=-1;d <= (TOTAL_ELEMENTS-2);d++) - printf("%d\n",array[d+1]); +#ifdef DEBUG + printf("sizeof(array) = %d\n", TOTAL_ELEMENTS); +#endif + + for (d = 0; d < TOTAL_ELEMENTS ; d++) + printf("%d\n", array[d]); return 0; } diff --git a/gowrikumar/Makefile b/gowrikumar/Makefile index 76fbc35..a90a693 100644 --- a/gowrikumar/Makefile +++ b/gowrikumar/Makefile @@ -3,4 +3,8 @@ all: 00-sizeof + 00-sizeof: 00-sizeof.o + + +.PHONY: all