Why this code is not giving desired result?

Program to Print All Possible Paths from Top Left to Bottom Right of a Matrix

by desired output if u mean that last ele i.e 9 is not printing thats coz ur base cond is executing b4 storing the last ele
jst move line 22 to line 16

Yes…It’s still not working.
It is also printing the elements under diagonal path.

I think the last element can only be print explicitly.

thats coz u r passing vector by reference
jst remove ‘&’ in line 13

Oh yes! Thank you…