Jump to content
Excelsior Forums
Sign in to follow this  
dodo

Another problem with pointers

Recommended Posts

I have another problem with pointers. I wrote a simple function in C++ as follows:

extern "C" __declspec(dllexport) void display_values(int *arr)

{

    int i;

    for(i=0;i<8;i++)

    {

        int val=*(arr+i);

        printf("%d ", val); 

        printf("\n");

    }

}

and I used XFunction to call this function from Java. I made an array of 8 integers and passed a pointer to the first element of this array to my function. But when the program runs it gives only the right value of the first element in the array and it does not give the rest right, it displays this result:

1

11545420

131132

17432929

0

1114182

1048647

1048648

Please help me :'(

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×