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.

WSGetIntegerArray() allocates memory which must be disowned by calling WSDisownIntegerArray(). If WSGetIntegerArray() fails and the function's return value indicates an error, do not call WSDisownIntegerArray()on the contents of a.

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

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

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

WSGetIntegerArray() is equivalent to (NonWLLink[WSGetInteger32Array(), paclet:ref/c/WSGetInteger32Array]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (1)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

#include "wstp.h"

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

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

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

	/* ... */

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

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

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Manipulating Expressions in External Programs, paclet:tutorial/ManipulatingExpressionsInExternalPrograms])}, {▪(RefLinkPlain[Handling Lists, Arrays and Other Expressions, paclet:tutorial/HandlingListsArraysAndOtherExpressions])}, {▪(RefLinkPlain[Portability of WSTP Programs, paclet:tutorial/PortabilityOfWSTPPrograms])}, {▪(RefLinkPlain[WSTP C API Developer Guide (Mac OS X), paclet:tutorial/WSTPDeveloperGuide-MacintoshOverview])}, {▪(RefLinkPlain[WSTP C API Developer Guide (Unix and Linux), paclet:tutorial/WSTPDeveloperGuide-UnixOverview])}, {▪(RefLinkPlain[WSTP C API Developer Guide (Windows), paclet:tutorial/WSTPDeveloperGuide-WindowsOverview])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Alphabetical Listing of WSTP C Functions, paclet:guide/AlphabeticalListingOfWSTPCFunctions])}, {▪(RefLinkPlain[WSTP C Functions for Exchanging Data, paclet:guide/WSTPCFunctionsForExchangingData])}, {▪(RefLinkPlain[WSTP C Functions for Exchanging Integers, paclet:guide/WSTPCFunctionsForExchangingIntegers])}, {▪(RefLinkPlain[WSTP C Functions for Exchanging Multidimensional Arrays, paclet:guide/WSTPCFunctionsForExchangingMultidimensionalArrays])}})}})