CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2010
    Posts
    1

    Help Solving Maze using pointers and Search

    Ive written a program that takes a txt file and reads in a maze.. My approach is not the best.. However, im really close to being done. I can't figure out how to get my search function to be equal to the place in the array.

    im trying to set current to what i return in the searchArray function.

    Please Help!
    Attached Files Attached Files

  2. #2
    Join Date
    Apr 1999
    Posts
    27,449

    Re: Help Solving Maze using pointers and Search

    Quote Originally Posted by ryan33m View Post
    Ive written a program that takes a txt file and reads in a maze.. My approach is not the best.. However, im really close to being done. I can't figure out how to get my search function to be equal to the place in the array.

    im trying to set current to what i return in the searchArray function.

    Please Help!
    Why didn't you use container classes such as std::vector or std::list instead of trying to code your own? You've turned the maze problem into a linked list/dynamic array maintenance problem.

    Secondly, your code leaks memory all over the place. You are really not close in completing the problem, until you take care of all of these memory leaks. You call "new" without calling "delete" one time in your entire code. You can't write C++ code that allocates memory, and then not write code to deallocate that memory properly.

    Third, have you used the debugger to solve your problem? If you wrote the code, you must be able to debug your own code. If you have used the debugger, where have you observed your program not behaving correctly?

    Regards,

    Paul McKenzie

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured