What happens when we make a variable of datatype int which starts with 0 and followed by another digits

int a = 0123;
cout<<a<<endl;//not gives me 0123 why?

hi @mukuuu
this is because, it’s taken as octal base (8), since that numeral have 0 in leading. So, it’s corresponding decimal value is 10

012 :

(2 * 8 ^ 0) + (1 * 8 ^ 1) = 10

0123 :

(3 * 8 ^ 0) + (2 * 8 ^ 1) + (1 * 8 ^ 2) = 83

@mukuuu,
I hope you are satisfied with @asaurabh_26’s explanation.