A little C Puzzle

Question mark
Image by Gordon Johnson from Pixabay

The following C program doesn’t output anything. Why?

#include<stdio.h>

#define TOTAL_ELEMENTS (sizeof(array) / sizeof(array[0]))
int array[] = { 23,34,12,17,204,99,16 };

int main()
{
    int d;

    for (d = -1; d <= (TOTAL_ELEMENTS - 2); d++)
        printf("%d\n", array[d + 1]);

    return 0;
}

 

This came from this site by Gowri Kumar which has a lot more C puzzles. Answer in a day or two…

(Visited 37 times, 1 visits today)

One thought on “A little C Puzzle

Comments are closed.