# (*lock)[index] = new_token; // or maybe this also works lock[index] = new_token; This is probably what you want