Another point is that by doing strcpy(bc_str, "") you are just putting a '\0' in bc_str[0], leaving the rest of the array uncleared. With adding a string terminator as already suggested, this line becomes vitually redundant anyway, but if you really want to clear the array, use something like...