I have two structs
Code:
struct boardstate{
int board[9][9];
int wpawns, wknights, wbishops, wrooks, wqueens, wkings;
int bpawns, bknights, bbishops, brooks, bqueens, bkings;
int wkcastle, wqcastle, bkcastle, bqcastle;
int drawcounter;
int legalmoves;
int wenpassant[2], benpassant[2]; //[0]=i; [1]=j
int whitekcastle, whiteqcastle, blackkcastle, blackqcastle;
int wkingloc[2], bkingloc[2];
char absoluteboard[9][9]; //used to record pieces which cannot move due to absolute pins
int dangerboard[9][9]; //used to record squares which the king cannot move to
int reversedangerboard[9][9]; //used to record squares which the non-moving king cannot move to
int allpossiblemoves[65][65]; //lists all possible move targets [y] for piece at square [x], equal to value of piece at [x]
int allpossiblepositions[65][65]; //lists all possible move targets [y] for piece at square [x], equal to value of position at p[z]
int wincheck; int bincheck;
enum whoseturn color;
int turn;
double evaluation;
double bestmoveeval;
int loci, locj, targeti, targetj; //records to-from squares for piece which just moved
};
extern struct boardstate p[100];
extern struct boardstate X;
I want to make a copy of p[0], which is why I created X. Is there a way to copy everything from p[0] into X, or do I have to transfer each variable independently? Somewhere I read that memcopy might somehow do this, but I haven't seen anything which shows the necessary syntax.