Round-Robin Review

Sample C Program

Below is an example C program for review. Assume that the program is functional, and produces the result the programmer expected.

/* example1.c */
/* LB */

typedef int Int;

#include <stdio.h>

main(int argc, char **argv){
    if(argc != 1)
        return 0;
        printf("The answer is %d.\n", myfunc(2,6));
        #define ONE 1
}

myfunc(
    Int a,
    Int b)
{
    int i = ONE, j = ONE;
    for( ; i <= b; ++i) j = j * a;
    return j;
}