Current Path : /compat/linux/proc/self/root/usr/local/share/examples/check-0.9.6/src/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : //compat/linux/proc/self/root/usr/local/share/examples/check-0.9.6/src/money.c |
#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; }