swig/Examples/mzscheme/simple/example.c
Thien-Thi Nguyen 9b441d2630 Initial revision
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@392 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2000-04-06 08:26:59 +00:00

24 lines
374 B
C

/* Simple example from documentation */
/* File : example.c */
#include <time.h>
double My_variable = 3.0;
/* Compute factorial of n */
int fact(int n) {
if (n <= 1) return 1;
else return n*fact(n-1);
}
/* Compute n mod m */
int my_mod(int n, int m) {
return (n % m);
}
char *get_time() {
long ltime;
time(&ltime);
return ctime(&ltime);
}