Pascal triangle print all rows

getting segmentation fault… what is the error?

@chaman9, there is some indexing problem in your code ,
like in line 25 ,it should be temp.push_back(res[i-2][j-2] + res[i-2][j-1]);
also at line 32 , it should be for(int i=0; i<n; i++) instead of for(int i=1; i<=n; i++)
so you have to take input for single test case , and provide spacing to your output in the prescribed format

corrected code :-

@O17LPOLA020023 thank you so much for clearing it!!