Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: c++ code question

Author: macaroni

Date: 20:55:47 11/24/03

Go up one level in this thread


On November 24, 2003 at 23:23:41, Russell Reagan wrote:

>On November 24, 2003 at 22:32:08, macaroni wrote:
>
>>another question...how could the following function be called?
>>
>>int MoveGenerator(int turn,Move* List[100]) the idea is, i want to pass it the
>>pointer of an array of 'Move's and it fills the array with possible moves. The
>>function compiles fine, but I don't know how to call it.
>>thanks again
>
>An array is the same thing as a pointer (more or less). So your function should
>be one of the following, but not both:
>
>int MoveGenerator ( int turn, Move * List );
>int MoveGenerator ( int turn, Move List[] );
I want to parse the pointer of a move list into the function so it can be
changed inside the function, the bottom of your two would parse it in to be used
by the function wouldn't it?
Lets say I use the top one. How would I then call MoveGenerator? with
'MoveCount=MoveGenerator(turn, &AllMoves);' where allmoves is an array with 100
elements? and if so, once inside the function MoveGenerator, how do I edit
AllMoves (*List)?
thanks for helping.
>
>There isn't a need to put the size. You know what the size is. Putting it won't
>stop your code from going past the end of the array. If you want that
>functionality, use a vector.



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.