[c] check the null terminating character in char*