I was practicing some C related MCQ's and I came across a question to predict output. Here's the question:
#include <stdio.h>
int main(void) {
    char a = '012';
    char b = '\012';
    printf("%d %d", a, b);
    return 0;
}
The Output given was: 50 10
Then I added following more lines and executed on gcc compiler
#include <stdio.h>
int main(void) {
    char a = '\012';
    char b = '\08';
    char c = '012';
    char d = '\0x12';
    printf("%d %d %d %d", a, b, c, d);
    return 0;
}
and the output I got was 10 56 50 50  (See this)
For some variables I think the ASCII of last char is assigned but not for all. Can anyone explain this behavior and How values are assigned ? And it would be helpful if anyone can quote references for these.
