Serial - Is possible to put a received data in an array of char ?

Good Morning, firstly I'd like to say thanks you for the support :slight_smile:

so I've tried to do in this way ...

int incomingByte = 0;   // for incoming serial data

void setup() {
        Serial.begin(9600);  
        
}
  int x = 0;
int done_receiving;
void loop(){
char incomingArray[128];
if (done_receiving == 0)
   { // more data expected
     if (Serial.available()>0){
          incomingArray[x] = Serial.read();
            if (incomingArray[x] == '\0')
               { 
                 done_receiving = 1;
                  x = 0;
                }
       else 
         {
           x=x+1;
         }
         Serial.println(incomingArray);
         incomingArray[0] = '\0';
} // end serial available 

} // end done check
} // end void loop

but when I open the arduino monitor and try to type " test " my expectation is at the end to have printed "test" again but I received it:

testpippoʼßë¿Þ~÷¡ï¼w÷_øu¿Íùxê?¯}ïϧ?kî÷õ«Ñ?×þ¿öõù?¤?xßÿ7^?ºÖtÞxO²ÿ)?m?~m¹_5?<rïë;ß½jw<ÿí<¸Gëï?o~oÿ¨ï??ߐ×7VV
testpippoʼßë¿Þ~÷¡ï¼w÷_øu¿Íùxê?¯}ïϧ?kî÷õ«Ñ?×þ¿öõù?¤?xßÿ7^?ºÖtÞxO²ÿ)?m?~m¹_5?<rïë;ß½jw<ÿí<¸Gëï?o~oÿ¨ï??ߐ×7VV
testpippoʼßë¿Þ~÷¡ï¼w÷_øu¿Íùxê?¯}ïϧ?kî÷õ«Ñ?×þ¿öõù?¤?xßÿ7^?ºÖtÞxO²ÿ)?m?~m¹_5?<rïë;ß½jw<ÿí<¸Gëï?o~oÿ¨ï??ߐ×7VV
testpippoʼßë¿Þ~÷¡ï¼w÷_øu¿Íùxê?¯}ïϧ?kî÷õ«Ñ?×þ¿öõù?¤?xßÿ7^?ºÖtÞxO²ÿ)?m?~m¹_5?<rïë;ß½jw<ÿí<¸Gëï?o~oÿ¨ï??ߐ×7VV

due the fact there is my word "test" and near there is pippo that another word typed before ...

where is my fault ? should be great to have only "test"

could exit a specific function or method to call ?

Thanks
Andrea