Set asisde space for ADT when reading integers from file

Posted by That Guy on Stack Overflow See other posts from Stack Overflow or by That Guy
Published on 2010-05-19T13:15:17Z Indexed on 2010/05/19 13:40 UTC
Read the original article Hit count: 194

I'm using C to make maze solver. The program should be able read a maze from a text file containing a grid of 1 and 0 representing walls and paths. This file could be of any size as the user selects which maze to use. The program should then show the maze being solved. As the maze is being solved it should show where has been walked and how many steps have been taken. I have made an ADT called Cell containing a bool for wall or path and an integer for steps taken. I now need to populate a 2D array of Cells which means I need to set aside enough space to store a Cell for every integer in the maze file. What would be the best way to do this?

© Stack Overflow or respective owner

Related posts about malloc

Related posts about filesize