I have:
#include <stdio.h>
int main(void) {
printf("%c","ACEGIK"[3] - 1);
return 0;
}
I know that the result is F, but why?
I don’t understand that [3]-1.
>Solution :
"AGECIK" is an array of chars
you’re taking the third element (counting from 0) "ACEGIK"[3] that’s G
subtracting 1 'G' - 1 and getting character F
[3] is applied to the array
while -1 is applied to character/value got from the array