I'm using a boolean typedef and recieivng these errors, I think it's due to the fact the way I'm passing.
Im a little unsure since this is the first time Ive tried to use typedefs
ERRORS:
a3q1.c: In function `checkPawn':
a3q1.c:45: warning: passing arg 1 of `kingInCheck' from incompatible pointer typ
e
a3q1.c:48: warning: passing arg 1 of `kingInCheck' from incompatible pointer typ
e
Undefined first referenced
Code:
#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
//#define TRUE 1
//#define FALSE 0
#define BOARDSIZE 8
typedef enum
{
FALSE,TRUE
}boolean;
boolean kingInCheck(char movesBoard[],int xVal,int yVal,boolean white,int xKing,int yKing);
void checkPawn(char realBoard[BOARDSIZE][BOARDSIZE],char movesBoard[BOARDSIZE][BOARDSIZE],int x, int y,int xKingW,int yKingW,int xKingB,int yKingB)
{
boolean whiteInCheck=FALSE;
boolean blackInCheck=FALSE;
//moves
//if P and on line 2
//then can move [i][j+1] or [i][j+2]
//or if others in these spots[i-1][p+1]
//or if others in these spots[i+1][p+1]
if(realBoard[x+1][y]==' ')//empty, can move there
{
//moves the pawn to that position to test for check
movesBoard[x+1][y]=realBoard[x][y];
movesBoard[x][y]=' ';
whiteInCheck = kingInCheck(movesBoard,x,y,TRUE,xKingW,yKingW);
//if white not in check, then see if black is in check
if(whiteInCheck==FALSE)
blackInCheck = kingInCheck(movesBoard,x,y,FALSE,xKingB,yKingB);
if(blackInCheck==TRUE)
{
//print it results in a check
printf("%c%i",y+83,x);
printf("%2c %2c%i",'-',y+83,x+1); //not a capture
}
}
//if(x==2) //on home row can move y+2
}
I included the kingInCheck header to show what it's meant to be accepting as args.
(BTW: just a basic text program to see if a move will result in a check)
want to pass true/false because same method could check for black and white king, because ur king cant be in check for the move to be valid.