invalid conversion from 'char*' to 'char' f permessive

i want to create a function that search a specific caracter in a Gcode especially commands like"M" & "G" get,convert and return the digit that follow