16-bit signed binary integer


Sample C++ usage C subroutine
#include <stdio.h>
#include <stdlib.h>

extern "C" int cfunc(short int msi);

int main()
{
  int rc;

  short mysi = 2;

  rc=cfunc(mysi); /* by value */
  printf("mysi=%hd rc=%d\n",mysi,rc);

}
#include <stdio.h>
#include <stdlib.h>

int cfunc(short mysi);

int cfunc(short int mysi)
{
  mysi=5;
  printf("mysi=%hd, rc=%d\n",mysi,mysi);

  return((int)mysi);
}


Sample C++ usage C subroutine
#include <stdio.h>
#include <stdlib.h>

extern "C" int cfunc( short int *msi );

int main()
{
  int rc;

  short mysi = 2;
  short *pmysi;

  pmysi=&mysi;
  rc=cfunc(pmysi);
    /* by reference */
  printf("mysi=%hd rc=%d\n",mysi,rc);

}
#include <stdio.h>
#include <stdlib.h>

int cfunc(short *mysi);

int cfunc(short int *mysi)
{
  *mysi=5;
  printf("mysi=%hd, rc=%d\n",*mysi,*mysi);
  return((int)*mysi);
}