The problem is that you’re acting like each character is the number it looks like. But ASCII 0
is not int 0
.
You might want something like this:
selected[i] = number[j] - '0'; /* convert ASCII to int */
1
solved Maximum product of 13 adjacent digits – Project Euler