#include <stdio.h>
#include "checkit.h"

void pointersToVars(void)
{
    int a, b;
    int* c;

    a = 14;
    b = 1;
    c = &a;
    *c = 3;
    checkit_int(3, a);
    checkit_int(1, b);
    checkit_int(3, *c);

    a = 9;
    checkit_int(9, a);
    checkit_int(1, b);
    checkit_int(9, *c);

    c = &b;
    b = 5;
    checkit_int(9, a);
    checkit_int(5, b);
    checkit_int(5, *c);
}

void inputOutputParameters(int* one, char* two)
{
    if (*one > 0) {
        *one = 2 * *one;
    }
    *two = 'A';
}

void arrays(double a[])
{
    a[2] = 0.0;
}

int main(void)
{
    int a = 14;
    char c = 'X';
    double nums[5] = { 1.4, 2.5, 3.6, 4.7, 5.8 };
    pointersToVars();

    inputOutputParameters(&a, &c);
    checkit_int(28, a);
    checkit_char('A', c);

    arrays(nums);
    checkit_double(0.0, nums[2]);
    checkit_double(1.4, nums[0]);
    return 0;
}