A friend helped me with this code and I don’t understand how it works. in the 5th line is (*pp-97)*4 basically the size of the char 110 so (110-97)*4 or the scanned value of pp? Thanks
char *pp =(char*)malloc(110);
printf("Enter text: ");
scanf("%s", pp);
*pp = *(pp + n);
int f = (*pp - 97)*4;
Note that
*ppis equivalent topp[0], and generally*(pp + n)is equivalent topp[n], socould also be written
pp[0] = pp[n];, that copies thecharat offsetnto the firstcharat offset 0.and this could be written
so 97 (the ASCII value of
'a') is subtracted from the firstcharin the blockpppoints to, and that difference is multiplied with 4.