Phone keypad code

IN THE CODE GIVEN IN VIDEO PLEASE TELL HOW THE FOR LOOP IS WORKING… IT IS TOTALLY CONFUSING.
When
for(int k=0; keypad[digit][k]!=’\0’;k++)
{
op[j]=keypad[digit][k];
print(in,op,i+1,j+1);
}
please tell in this how this is working when k=0 op[0] will be equal to A thn print(in,op,i+1,j+1) will get executed then k also becomes 1 i ==1 and j ==1 …no when we again execute the op[j]=op[1] = keypad[2][1] = B … but op[1]can not be B
According to Prateek bhaiya phele op array mai when j=0 A aayega ya B ya C aayega… then print will get executed…
This is becoming very confusing kindly uodate the video or clear the doubt here asap…

print statement will get executed after every line of op[j] then how we ar getting B and C in op array

Hi @pradumnshukla we are looping over the value of keypad through this loop, like if you press 3, then ''a b c" are the possible options so we are iterating over the entire string. so we fix jth index of the output array and increase value of i and j to call the function for the rest of the part.
now, when k = 0, i = 0, j = 0, AFTER function comes back from printKeypad(in, op, i+1, j+1), these values will still be same, after k++ in next iteration k = 1, i = 0, j = 0. i and j increased their values for the next function call, not the current one. if you have any confusion just print the values of i, j, k etc at each step and you can see for yourself how the values are changing.