int num1[26] = {0}, num2[26] = {0}, i = 0;
it means, num1 is array of 26 integers, the indexes indirectly specifies that,
num1[0] = number of occurances of 'a'
num1[1] = number of occurances of 'b' ... etc
num1 is for string1, and num2 is for string2.
at the end he will compare num1[i]==num2[i] or not, if for every index it holds then those strings are anagrams !
coming to your doubt:-
num1[array1[i] - 'a']++;
array1[i] means the character in the string and subtracting 'a' means getting it's index value in the num1[].
How ?
let my string is "masthan" ,
array[0]='m' and array[1]='a' and array[2]='s' and array[3]='t' and array[4]='h' and array[5]='a' and array[6]='n'
let the i is the 3, then
num1[array1[3]-'a']++; ===> num1['t'-'a']++;
t=116 (as per ascii) and a = 97 ==> 't'-'a' = 116-97=19 which is the index of t
therefore num[19]++;