Function Programs
/***********************************************//* */
/* Function Snakes & Ladders */
/* */
/***********************************************/
#include
/***********************************************/
/* Level 0 */
/***********************************************/
main ()
{
printf ("This is level 0: the main program\n");
printf ("About to go down a level \n");
DownOne ();
printf ("Back at the end of the start!!\n");
}
/************************************************/
/* Level 1 */
/************************************************/
DownOne () /* Branch out! */
{
printf ("Down here at level 1, all is well\n");
DownLeft (2);
printf ("Through level 1....\n");
DownRight (2);
printf ("Going back up a level!\n");
}
/************************************************/
/* Level 2 */
/************************************************/
DownLeft (a) /* Left branch */
int a;
{
printf ("This is deepest level %d\n",a);
printf ("On the left branch of the picture\n");
printf ("Going up!!");
}
/************************************************/
DownRight (a) /* Right branch */
int a;
{
printf ("And level %d again!\n",a);
0 comments:
Post a Comment