Error digitalRead from char

buffer is a character array; why do you use it in the digitalRead that takes an int as a parameter? x_arr is the array with the pins (and is of type int); you can use it directly.

Without seeing the full code, be aware that when using the new keyword, you also have to delete the array; else you have a recipe for exhausting your memory.