hello, i have a question about char and int
-
hello everyone, i still understand this question: char a = '1'; printf("%d",a ); //can get 49 printf("%c",a ); //can get 1 how can i know why it can printf 49?? somethings have between about char and int ?????? thank you
-
hello everyone, i still understand this question: char a = '1'; printf("%d",a ); //can get 49 printf("%c",a ); //can get 1 how can i know why it can printf 49?? somethings have between about char and int ?????? thank you
-
hello everyone, i still understand this question: char a = '1'; printf("%d",a ); //can get 49 printf("%c",a ); //can get 1 how can i know why it can printf 49?? somethings have between about char and int ?????? thank you
printf("%d",a ); //can get 49
This line says print the decimal value of variable a; since a contains the character '1' it prints the ASCII value, which is 0x31 or 49 decomal.
printf("%c",a ); //can get 1
This says print the character stored in variable a, which is the character '1'.
Just say 'NO' to evaluated arguments for diadic functions! Ash