/* Collection of code snippets by Arne Vajhøj */
/* (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) */
#include <stdio.h>
#include <string.h>
#include <stdlib.h>

#include "demolib.h"

int main()
{
    int a, b, c, allsix, iv;
    char *s, *s2, *sv;
    int six[] = { 1, 2, 3, 4, 5, 6 };
    struct Data1 *d1;
    struct Data2 d2;
    /* */
    a = 123;
    b = 456;
    c = add(a, b);
    printf("%d\n", c);
    /* */
    allsix = sum(6, six);
    printf("%d\n", allsix);
    /* */
    s = "ABC";
    s2 = dup(s);
    printf("%s\n", s2);
    free(s2);
    /* */
    get_out(&iv, &sv);
    printf("%d %s\n", iv, sv);
    free(sv);
    /* */
    d1 = get_ret();
    printf("%d %s\n", d1->iv, d1->sv);
    /* */
    d2.iv1 = 123;
    strcpy(d2.sv1, "ABC");
    chg(&d2);
    printf("%d %s\n", d2.iv2, d2.sv2);
    /* */
    return 0;
}
