ADDING NUMBERS WITH CHARACTERS
void main()
{
char ch[10];
printf(“enter:”);
gets(ch);
printf(“\n%c”,(*ch+1));
}
output:
enter:APPLE
B
can’t understand just go through the explanation….
if u enter “APPLE” in to the array ch then (*ch+1) will first add the number
one with the first character of the array (actually the ascii value of the character) hence here
when one is added with the ascii value of ‘A’ produces the next character ‘B’ which is the output.
Categories: C PROGRAMMING
PROGRAMMING
feedback