Advertisement
Guest User

Untitled

a guest
Feb 17th, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.06 KB | None | 0 0
  1. /* a programme designed for playing 5x5 tic-tac-toe, either against the computer or another player*/
  2. /*Made by Ike Nnadozie Jason, student number 201275074.*/
  3. /*last edited on 17/02/2019*/
  4.  
  5. //Libraries included
  6. #include <stdio.h>
  7. #include <stdlib.h>
  8. #include <math.h>
  9.  
  10. void reset_board(char (*this_board)[unsigned int Rows][unsigned int Columns]);
  11. void print_board(char (*this_board)[unsigned int Rows][unsigned int Columns]);
  12.  
  13.  
  14. int main(void)
  15. {
  16.     int Rows, Columns = 5;
  17.     char my_board[Rows][Columns];
  18.    
  19.     reset_board(my_board[Rows][Columns]);
  20.    
  21.     print_board(my_board[Rows][Columns]);
  22. }
  23.  
  24. void reset_board(char (*this_board)[unsigned int Rows][unsigned int Columns])
  25. {
  26.     int r, c;
  27.    
  28.     /* Reset board */
  29.     for(r=0; r<Rows; r++)
  30.     {
  31.         for(c=0; c<Columns; c++)
  32.         {
  33.             this_board[r][c] = ' ';
  34.         }
  35.     }
  36. }
  37.  
  38. void print_board(char (*this_board)[unsigned int Rows][unsigned int Columns])
  39. {
  40.     int r, c;
  41.    
  42.     /* Print board */
  43.     for(r=0; r<Rows; r++)
  44.     {
  45.         for(c=0; c<Columns; c++)
  46.         {
  47.             printf("\nthis_board[%d][%d] = %c", r, c, this_board[r][c]);
  48.         }
  49.     }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement