What's wrong with the code?

when i write

Change(s,i+5) it doesn’t work;

it works with Change(s,i+4);

but i think it should be i+5.
please explain.

hi @priyamthakuria27
suppose pi starts at ith index
then

a[i] = p 
a[i+1] = i

After replacing pi with 3.14

a[i] = 3
a[i+1] = .
a[i+2] = 1
a[i+3] = 4

So now the next character will be at i+4

Dont forget to mark your doubt as resolved!