php: Test multiple return values in pointer example
This commit is contained in:
parent
1eab01ad1f
commit
c9d64f0bed
2 changed files with 7 additions and 10 deletions
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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";
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue