You are declaring your function
Code:
void SetBoard(char board[][79], SHIP* player);
before you declare your struct SHIP. Correct code is:
Code:
#include <iostream.h>
#include <conio.h>
struct SHIP //ship coordinate struct
{
int top0;
int top1;
int top2;
int top3;
int top4;
int top5;
int top6;
int top7;
};
void SetBoard(char board[][79], SHIP* player);
void ShowBoard();
int main()
{
int keypress=0; //for player hitting a key
char board[51][79]; //board
SHIP playership;
playership.top0=38; //a & b coordinates for ship
playership.top1=49;
playership.top2=38;
playership.top3=50;
playership.top4=39;
playership.top5=50;
playership.top6=37;
playership.top7=50;
SHIP* player;
player=&playership; //for changing playership
SetBoard(board, player);
_getch();
return 0;
}
// *****************************************FUNCTIONS
//****************************************
void SetBoard(char board[][79], SHIP* player)
{
for(int a=0;a<=50;a++) //initialize board
{
for(int b=0;b<=78;b++)
{
board[a][b]=' ';
}
}
board[player->top0][player->top1]='*';
board[player->top2][player->top3]='*';
board[player->top4][player->top5]='*';
board[player->top5][player->top7]='*';
}