I am working on below code:

#include<iostream>
#include<stdio.h>

using namespace std;

main() {
    unsigned char a;
    a=1;
    printf("%d", a);
    cout<<a;
}

It is printing 1 and some garbage.

Why cout is behaving so?

Edit
Report