[Solved] Segmentation Fault on return of main function [closed]
Look at your loop here: for(int i=0; i<3*n; i++) { all[j].h = b[i].h; all[j].w = min(b[i].w,b[i].l); all[j].l = max(b[i].w, b[i].l); j++; // increment all[j].h = b[i].l; all[j].w = min(b[i].w,b[i].h); all[j].l = max(b[i].w, b[i].h); j++; // increment again all[j].h = b[i].w; all[j].w = min(b[i].l,b[i].h); all[j].l = max(b[i].l, b[i].h); j++; // increment once again } Look at … Read more