Hi, my current C project is a program that looks at a text file with a matrix inside. The format of the matrix is like so:

1,2,5,6

5,6,7,8

1,8,7,9

1,1,3,2:

The matrix can be comprised of ANY set of numbers so long as the matrix is size n x n.

The program has to be able to find a path from the top-left of the matrix to the bottom-right of the matrix that costs the least sum; in this case of the example matrix above the solution is: 1,5,1,1,1,3,2

So, i need a way for the program to go through every possible path and store the data so as not to retrace the paths already taken.

The solution i've come up with requires me to be able to store arbitrary amounts of data because 'n' in the n x n matrix is variable.

If i haven't made it clear already, i can't use something like "path[i]" because there is not a set amount of paths. Someone suggested linked lists but i don't see how i can create a linked list of any desired size.

This may not have been a very clear explanation, i can clarify if anyone has questions.