In C, '@' is an int. But, type char
is the size of 1 byte.
main()
{
char arroba = '@';
printf("tamanho '@' = %d\n", sizeof('@'));
printf("tamanho char = %d\n", sizeof(arroba));
return 0;
}
The output of the program is:
leandro@macbook /tmp % ./a.out
tamanho '@' = 4
tamanho char = 1
So you can add with an integer. In your example:
'@' + 1 = 'A'
'@' + 2 = 'B'
'@' + 3 = 'C'
In printf, you can format it using %c
, but see that you can truncate the result of the sum. In the sample program, there is no such problem.