Receiving long data using Serial

Thank you, Robin and Paul, for the tips appreciate that!

I rearranged my code, and everything was working fine until I decided to receive more than 255 characters.

With const byte numChars = 255; I am limited to max 255 characters

With const word numChars = 300; I am receiving only 77 characters, even not from the beginning of a message I am sending...

Same applies to const int numChars = 300;

what am I doing wrong?

#include<SoftwareSerial.h> 
SoftwareSerial s(15,13);

const int numChars = 300;
char receivedChars[numChars];

boolean newData = false;

void setup() {
    Serial.begin(19200);
    s.begin(19200);
    Serial.println("<Arduino is ready>");
}

void loop() {
    recvWithStartEndMarkers();
    showNewData();
}

void recvWithStartEndMarkers() {
    static boolean recvInProgress = false;
    static byte ndx = 0;
    char startMarker = '<';
    char endMarker = '>';
    char rc;
 
    while (s.available() > 0 && newData == false) {
        rc = s.read();

        if (recvInProgress == true) {
            if (rc != endMarker) {
                receivedChars[ndx] = rc;
                ndx++;
                if (ndx >= numChars) {
                    ndx = numChars - 1;
                }
            }
            else {
                receivedChars[ndx] = '\0'; // terminate the string
                recvInProgress = false;
                ndx = 0;
                newData = true;
            }
        }

        else if (rc == startMarker) {
            recvInProgress = true;
        }
    }
}

void showNewData() {
    if (newData == true) {
        Serial.println(receivedChars);
        newData = false;
    }
}

thank you