#include <stdio.h>
#include <stdlib.h>

int main(int argc, const char *argv[])
{
  unsigned char foo = 100; // Here we declared a variable from type char and assigned the value 100.
  printf("foo: %d\n", foo);

  foo += 100; // += is the same as writing foo = foo + 100;
  // When we print this out it should say foo: 200
  printf("foo: %d\n", foo);

  foo += 100;
  // Now see what happens when we print out foo again
  printf("foo: %d\n", foo);
  // This is called an overflow. The types wasn't big enough to hold 300 so it wrapped around.

  // remember when you declare an integer as signed the positive range shrinks
  signed char bar = 200;
  printf("bar: %d\n", bar);

  // Char is also the datatype used for characters.
  // You can tell printf to interpret foo as a character,
  // if you write %c instead %d as the formatting
  printf("foo: %c\n",foo);

  // if you want to assign the ASCII value of a character to a variable
  // just write it in ''
  foo = 'a';
  
  // You should choose your types carefully.
  // Here we want to divide to numbers
  
  int Divident = 1;
  int Divisor = 2;

  int Result = Divident/Divisor; 

  // Look at the result.
  printf("Result = %d\n", Result);
  // TODO: fix the division, such that the correct result is being displayed 
  // TIP: %f is used to print out floating point values
  
  // Integers can't represent real numbers.
  // But don't presume floats can represent every number.
  // as the numbers get smaller or bigger you get less precision
  // and your numbers get rounded to the next represented number.
}
