I have a very basic doubt. I am trying to store any invalid hex number in an int variable. By invalid number i mean a number that is using alphabets that are not in A-F
range. For example see this program:
#include<stdio.h>int main(){ int a; scanf("%X",&a); printf("%d",a); return 0;}
When console asks for input, I entered G
. It gave the output as 63
. Is it just undefined behaviour or there is some logic behind this output. For most of such inputs the output is coming out as 63
. Currently working on GCC.