lol
non metti il carattere di fine stringa nel vettore di caratteri,
char test[6];

......
test[5]='\0';