Sophie

Sophie

distrib > Mandriva > 2008.1 > x86_64 > media > main-release > by-pkgid > a6ec49c68bb1ab93bd1f371b6fb4fe78 > files > 28

lib64check0-devel-0.9.5-3mdv2008.1.x86_64.rpm

#include <stdlib.h>
#include "money.h"

struct Money
{
  int amount;
  char *currency;
};

Money *
money_create (int amount, char *currency)
{
  if (amount < 0)
    {
      return NULL;
    }

  Money *m = malloc (sizeof (Money));
  if (m == NULL)
    {
      return NULL;
    }

  m->amount = amount;
  m->currency = currency;
  return m;
}

int
money_amount (Money * m)
{
  return m->amount;
}

char *
money_currency (Money * m)
{
  return m->currency;
}

void
money_free (Money * m)
{
  free (m);
  return;
}