update stack in c