4
/* This example illustrates a couple of different techniques
5
for manipulating C pointers */
7
/* First we'll use the pointer library */
8
extern void add(int *x, int *y, int *result);
18
/* Next we'll use some typemaps */
21
extern void sub(int *INPUT, int *INPUT, int *OUTPUT);
23
/* Next we'll use typemaps and the %apply directive */
25
%apply int *OUTPUT { int *r };
26
extern int divide(int n, int d, int *r);
28
/* Try using pointers that are used as input and output */
29
%apply int *INOUT {int *z};
30
extern void negate(int *z);
33
void add(int *x, int *y, int *result) {
37
void sub(int *x, int *y, int *result) {
41
int divide(int n, int d, int *r) {