Convert from double pointer to integer pointer

Joined
Jun 27, 2009
Messages
1
Reaction score
0
There is a function that returns a pointer to a double array. I want to convert it to a pointer that points to an integer array because all the data that the function returns will be integers and I want to save memory.

I tried to type cast it, but the problem is that the location of the consecutive elements are 8 bytes away because the function returns a pointer to a double. So even if I type cast the pointer the location of each element will not change.

Is there a way for me to do this?

I am trying to avoid having to copy one array to another array because I shall be using a large amount of data. But if it comes to that is there an efficient method to copy from a double* to an array to an int* to an array?

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top