This is documentation for Mathematica 6, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)
MathLink C Function


int MLPutInteger16Array(MLINK link, short *a, int *dims, char **heads, int d)
puts an array of 16-bit integers to the MathLink connection specified by link to form a depth d array with dimensions dims.
  • The array a must be laid out in memory like a C array declared explicitly as short a[m][n]....
  • If heads is given as NULL, the array will be assumed to have head List at every level.
  • The length of the array at level i is taken to be dims[i].
  • MLPutInteger16Array() returns 0 in the event of an error, and a nonzero value if the function succeeds.
  • Use MLError() to retrieve the error code if MLPutInteger16Array() fails.
  • MLPutInteger16Array() is declared in the MathLink header file mathlink.h.
Click for copyable input
#include "mathlink.h"

/* send an array of 16-bit integers to a link */

void f(MLINK lp)
    short array[6][10][2][1];
    int dims[4];
    int i;

    for(i = 0; i < 120; i++)
        *((short *)array + i) = i;

    dims[0] = 6;
    dims[1] = 10;
    dims[2] = 2;
    dims[3] = 1;

    if(! MLPutInteger16Array(lp, (short *)array, (int *)dimensions, (char **)0, 4))
        { /* unable to put the array to lp */ }