Added example.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4603 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
7d2accbca7
commit
6418b0c755
4 changed files with 66 additions and 0 deletions
19
Examples/ocaml/argout_ref/example.c
Normal file
19
Examples/ocaml/argout_ref/example.c
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
/* File : example.c */
|
||||
|
||||
/* Compute the greatest common divisor of positive integers */
|
||||
int gcd(int x, int y) {
|
||||
int g;
|
||||
g = y;
|
||||
while (x > 0) {
|
||||
g = x;
|
||||
x = y % x;
|
||||
y = g;
|
||||
}
|
||||
return g;
|
||||
}
|
||||
|
||||
extern "C" void factor( int &x, int &y ) {
|
||||
int gcd_xy = gcd( x,y );
|
||||
x /= gcd_xy;
|
||||
y /= gcd_xy;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue