Convert from double pointer to integer pointer

Discussion in 'C Programming' started by asker123, Jun 27, 2009.

  1. asker123

    asker123

    Joined:
    Jun 27, 2009
    Messages:
    1
    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
    asker123, Jun 27, 2009
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. da Vinci
    Replies:
    5
    Views:
    8,701
    da Vinci
    Jul 31, 2004
  2. Sydex
    Replies:
    12
    Views:
    6,444
    Victor Bazarov
    Feb 17, 2005
  3. les ander
    Replies:
    4
    Views:
    861
    wes weston
    Oct 5, 2004
  4. Heiko Vogel
    Replies:
    3
    Views:
    544
    Method Man
    Sep 14, 2004
  5. Suresh V
    Replies:
    5
    Views:
    3,674
    SaticCaster
    Jul 5, 2010
Loading...

Share This Page