I found This program is K&R The C programming book I'm new to C programming
I'm not getting why the variable d is used and the value of d is change to d=0
then d=1 between program.

Can anyone explain me what this program logic does I know this program is to replace
tabs with \t likewise.

```
#include <stdio.h>

int main()
{
    int c, d;

    while ( (c=getchar()) != EOF) {
        d = 0;
        if (c == '\\') {
            putchar('\\');
            putchar('\\');
            d = 1;
        }
        if (c == '\t') {
            putchar('\\');
            putchar('t');
            d = 1;
        }
        if (c == '\b') {
            putchar('\\');
            putchar('b');
            d = 1;
        }
        if (d == 0)
            putchar(c);        
    }
    return 0;
}

```