#include <stdio.h>
int main()
{
    int end = 0;
    char d[5];
    int digits = 0;
    d[digits++] = digits;
    printf("digits=%d\n",digits);
    printf("d[0]=%d\n",d[0]);

    do{
        printf("if enter 1, end.");
        scanf("%d",&end);
    }while (end = 0);

    return 0;
}

---実行結果---
digits=1
d[0]=1
if enter 1, end.

---僕の理想の実行結果---
digits=1
d[0]=0 ←ここが0
if enter 1, end.