title: c int array to java int array using jni
body: <p>I have a function something similar to,</p>
  
  <pre><code>int * print(int count)
  {
      int * myarray;
      int i=0;
      myarray = (int *)(malloc(sizeof(int))*count);
      for(i=0;i&lt;count;i++)
      {
        myarray[i] = i;
      }   
     return myarray;
  }
  </code></pre>
  
  <p>Now how can i use myarray in java using JNI </p>
  
  <p>i tried like this </p>
  
  <pre><code>jintArray Java_com_example_testmyapp_MainActivity_JListPrint(JNIEnv* env, jobject thiz)
  {
       return print(5);
  }
  </code></pre>
  
  <p>and in java </p>
  
  <pre><code>int a[] = JListPrint()
  </code></pre>
  
  <p>but my app gets crashed</p>
  
  <p>Pointers, Suggestions please?</p>