Lab 3

Solutions for this lab is now available!

In this lab we will again use the coin swap program, but this time focussing on how to use parameters.

The Game

 The playing board starting position is:

      1  2  3  4  5

      X  X     O  O

The object of the game is to swap the X and O pieces, ending up with:

      1  2  3  4  5

      O  O     X  X

 X can only move a single square to the right, or jump an O to the right into an open square.  O can only move a single square to the left, or  jump an X to the left into an open square.  The ' ' denotes a blank space. 

What You Need to Do

Function calling examples:

Program functionCalling.c (included at the bottom of this page) has examples of 1. Using a function return type,  as well as 2. call-by-value parameters, and 3. call-by-reference parameters. 

You should have already read the Zyante background information on call-by-value and call-by-reference at:

https://zybooks.zyante.com/#/zybook/UICCS141Fall2015/chapter/5/section/2

https://zybooks.zyante.com/#/zybook/UICCS141Fall2015/chapter/5/section/9