Header file Game.h
#ifndef __game_h__
#define __game_h__
#define COLS 3
#define ROWS 3
void Init_game (char arr[cols][rows]);
void Display_board (char arr[cols][rows]);
void Player_move (char arr[cols][rows]);
void Computer_move (char arr[cols][rows]);
Char check (char arr[cols][rows]);
#endif//__game_h__
test.c//
#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include "game.h"
int main ()
{
Char Chess[cols][rows];
char done = 0;
Init_game (chess);
Do
{
Display_board (chess);
Player_move (chess);
Done = check (chess);
if (done! = ")
{
Break
}
Computer_move (chess);
Done = check (chess);
} while (done = = ");
if (' X ' = = done)
{
printf ("player wins \ n");
}
else if (' O ' = = done)
{
printf ("Computer wins \ n");
}
System ("pause");
return 0;
}
#include <stdio.h>
int main ()
{
int i = 0;
if (i = = 10)
{
printf ("%d\n", I);
}
Else
{
printf ("hhh\n");
}
return 0;
}
#include <stdio.h>
#include <assert.h>
#define __debug__
#if 0
int main ()
{
int i = 0;
int k = 0;
for (i = 0; i <; i++)
{
if (i = = 100)
{
__file__
__line__
__date__
__time__
__stdc__
#ifdef __debug__
printf ("file:%s line:%d i =%d", __file__, __line__, i);
#endif
}
}
System ("pause");
return 0;
}
#endif
#include <stdio.h>
int main ()
{
int a = 10;
int B = 20;
int *p = &a;
int *const q = &a;
Q = &b;error
*q = 40;
int const *R = &a;
r = &b;
*r = 30; Error
int const * CONST W = &a;
return 0;
}
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <stdlib.h>
char * my_strcpy (char *dest, const char *SRC)
{
ASSERT (dest! = NULL);
ASSERT (src! = NULL);
char *ret = dest;
while (*src! = ')
{
*dest++ = *src++;
}
*dest = ' + ';
while (*dest++ = *src++)
{
;
}
return ret;
}
int main ()
{
char *p = "Hello";
Char name[10] = {0};
printf ("%s\n", my_strcpy (name, p));
printf ("%d\n", strlen (my_strcpy (name, p))); chained access
System ("pause");
return 0;
}
#include <stdio.h>
#include "game.h"
int main ()
{
Fun ();
return 0;
}
Three-son chess