Newbie programmer here! I recently started learning about C and was making a small code about declaring an integer variable called "age" then printing it. Something like as follows:
#include<stdio.h>
int main(){
int age = 027;
int scnd_age = 27;
printf("My age is: %d\n", age);
printf("My age is: %d",scnd_age);
return 0;
}
To my surprise the output both times was totally different.first line says 23 while 2nd says 27
I've only used python in the past and I know it produces an error if you try to declare an integer variable which starts with 0, but I am curious why is it legal to do it in C and why does it gives different outputs?
Was trying to declare an integer variable called "age" then print it.
Tried storing both 27 and 027 in the said variable and surprisingly both times it printed different results.