#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);
}
|