#include <stdio.h>

/************************************************
 * Program demonstrating 
 * C expressions.
 * 
 * Author: Sarah Heckman, NCSU
 * Modified by: Julio Bahamon, UNC Charlotte
 ************************************************/

/* Function prototypes */
void prefix_postfix();
void division_remainder();

/**************************
 * Starts the program
 *************************/
int main() 
{
   prefix_postfix();
   division_remainder();

   return 0;
}

/***************************
 * Expressions 
 * from lecture 5
 **************************/
void prefix_postfix()
{
   //prefix operators
   int i = 1, j = 8;
   printf("%d %d\n", ++i, --j);
   printf("%d %d\n\n", i, j);

   //postfix operators
   int k = 1, l = 8;
   printf("%d %d\n", k++, l--);
   printf("%d %d\n\n", k, l);
}

/***************************
 * Expressions 
 * from lecture 5
 **************************/
void division_remainder()
{
   //Examples using mod
   printf("%d ", (37 % 3));
   printf("%d\n", (-37 % 3));

   int denominator = 0;

   //Division by 0 - floating exception (core dumped)
   int r = 5 % denominator;

}
