Processes queue in C