php: Test multiple return values in pointer example

This commit is contained in:
Olly Betts 2021-03-31 04:49:38 +13:00
commit c9d64f0bed
2 changed files with 7 additions and 10 deletions

View file

@ -21,10 +21,5 @@ extern void sub(int *INPUT, int *INPUT, int *OUTPUT);
/* Next we'll use typemaps and the %apply directive */
//%apply int *OUTPUT { int *r };
//extern int divide(int n, int d, int *r);
%apply int *OUTPUT { int *r };
extern int divide(int n, int d, int *r);

View file

@ -28,6 +28,8 @@
print " 37 - 42 = $r\n";
# Now try the version with multiple return values
# print "Testing multiple return values\n";
# ($q,$r) = divide(42,37);
# print " 42/37 = $q remainder $r\n";
print "Testing multiple return values\n";
$a = divide(42,37);
$q = $a[0];
$r = $a[1];
print " 42/37 = $q remainder $r\n";