Loop starting at -1 doesn't print anything

Viewed 7288

This program is supposed to print out the elements of array, but when it is run, no output is shown.

#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;
}

Why doesn't this program show any output?

3 Answers
Related