LFSTACK - Editorial

You have made the qq array with size q and above your code q is 0, thus you are getting segmentation fault SIGSEV.