OpenersNotesSection(Spacer1)Details

The array a is laid out in memory like a C array declared as int a[m][n]….

heads gives a list of character strings corresponding to the names of symbols that appear as heads at each level in the array.

MLGetIntegerArray() allocates memory which must be disowned by calling (NonWLLink[MLDisownIntegerArray(), paclet:ref/c/MLDisownIntegerArray]). If MLGetIntegerArray() fails and the function's return value indicates an error, do not call (NonWLLink[MLDisownIntegerArray(), paclet:ref/c/MLDisownIntegerArray])on the contents of a.

External programs should not modify the arrays generated by MLGetIntegerArray().

MLGetIntegerArray() returns 0 in the event of an error, and a nonzero value if the function succeeds.

Use (NonWLLink[MLError(), paclet:ref/c/MLError]) to retrieve the error code if MLGetIntegerArray() fails.

MLGetIntegerArray() is equivalent to (NonWLLink[MLGetInteger32Array(), paclet:ref/c/MLGetInteger32Array]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (1)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

#include "mathlink.h"

/* read an array of integers from a link */

void f(MLINK lp)
{
	int *data;
	long *dims;
	char **heads;
	long d;

	if(! MLGetIntegerArray(lp, &data, &dims, &heads, &d))
		{
			/* unable to read the integer array */
			return;
		}

	/* ... */

	MLDisownIntegerArray(lp, data, dims, heads, d);
}

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(NonWLLink[MLGetIntegerList(), paclet:ref/c/MLGetIntegerList])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Manipulating Expressions in External Programs, paclet:tutorial/ManipulatingExpressionsInExternalPrograms])}, {▪(RefLinkPlain[Handling Lists, Arrays and Other Expressions, paclet:tutorial/HandlingListsArraysAndOtherExpressions])}})}})