how to append char to char?

I have created a function that recognizes numbers and prints them as an int. However, when this function is applied to the main code, the controller is stopped due to lack of resources. I have never used a String type because I’ve been through resource shortage before using a String type.
I would like to change the return type to char, and not use sprintf and sscanf to further optimize this function.

I need help.
Thank you.

getData = { “33”, “2”, “65535”, “222”, “T”, …};

uint8_t checkDigit(char getData[], uint8_t startLen, uint8_t endLen){
uint8_t nod = k;
uint8_t nod = 0;
for(int i = startLen ; i <= endLen; i++){ 
    if(isDigit(getData[i])){
      nod++;
    }else{
      break;
    }
  }

char bufferArray[nod];
   uint8_t e = 0;
    for(uint8_t j = startLen ; j < startLen+nod ; j++){    
      bufferArray[e] = getData[j]; 
      e++;
    }     
  sscanf(bufferArray, "%5d%", &k);
  return k;
}


LoRa_main(){
if(receivedChars[2] == 'D' &&receivedChars[3] == 'e' && receivedChars[4] == 'v'){     
       LoRaParameter[1] = checkDigit(receivedChars,14,18);
}
.
.
.
sprintf(LoRaParameter, "%c %d %d %d %d %d %d %d %d %d %c", 
       LoRaParameterCH[0], LoRaParameterINT[0], LoRaParameterINT[1], LoRaParameterINT[2],
       LoRaParameterINT[3], LoRaParameterINT[4], LoRaParameterINT[5],LoRaParameterINT[6], 
       LoRaParameterINT[7], LoRaParameterINT[8],LoRaParameterCH[1]); 
}

I have some doubts that the controller is stopped due to lack of resources; but without seeing the full code it’s difficult to say.

To convert a sequence of ascii digits, you can use something like below. Not tested

uint8_t checkDigit(char getData[], uint8_t startLen, uint8_t endLen)
{
  uint8_t k = 0;
  for (int i = startLen ; i <= endLen; i++)
  {
    if (isDigit(getData[i]))
    {
      k = k * 10 + getData[i] - '0';
    }
    else
    {
      break;
    }
  }
  return k;
}

PS 1
I’m not sure how you think that 65535 will fit in an uint8_t.
PS 2
I suspect that getData must be an array of pointers or aa muktidimensional array.

Thank you very much for your reply.
I’m sorry, I wrote the getData wrong values in the first place and the variable was wrong. Thank you for pointing out.

getData was { “6”, “5”, “5”, “3”, “2”, “T”, …};

I had to specify a certain range of digits, each with a character to make a number.
Based on what you advised, I modified the code and applied it.

uint16_t checkDigit(char getData[], uint8_t startLen, uint8_t endLen){
  uint16_t k;
  uint8_t nod = 0;

  for(int i = startLen ; i <= endLen; i++){ 
    if(isDigit(getData[i])){
      nod++;
    }else{
      break;
    }
  }

  if(nod == 1){
    k = getData[startLen] - '0';
  }else if(nod == 2){
    k = (getData[startLen+1] - '0') + 10*(getData[startLen] - '0');
  }else if(nod == 3){
    k = (getData[startLen+2] - '0') + 10*(getData[startLen+1] - '0') + 100*(getData[startLen] - '0');
  }else if(nod == 4){
    k = (getData[startLen+3] - '0') + 10*(getData[startLen+2] - '0') + 100*(getData[startLen+1] - '0') + 1000*(getData[startLen] - '0');
  }else if(nod == 5){
    k = (getData[startLen+4] - '0') + 10*(getData[startLen+3] - '0') + 100*(getData[startLen+2] - '0') + 1000*(getData[startLen+1] - '0') + 10000*(getData[startLen] - '0');
  }

  return k;
}

I also remove sscanf and sprintf, and apply the above code to the main code, they will stop working while running.

I think there is a problem elsewhere.
Thank you for your help.

The process in the code in Reply #2 is not APPENDING characters, it is ADDING their values arithmetically.

In programming jargon when you append 'B' to 'A' your get "AB"

...R