Initial not working final code. Getting Segmentation fault at swapcontext() in scheduler()