unsigned short malloc ?

Discussion in 'C Programming' started by Zepper_fang, Jul 14, 2009.

  1. Zepper_fang

    Zepper_fang

    Joined:
    Jul 14, 2009
    Messages:
    1
    Likes Received:
    0
    Location:
    Brazil
    - Example:

    unsigned short *p = (unsigned short *)malloc(0x2000 * sizeof(unsigned short));

    - Is the cast on malloc needed?
    - Plus, if I do:

    unsigned short *x = &p[3];

    - So, x starts at byte 6, or 3rd value, correct?
     
    Zepper_fang, Jul 14, 2009
    #1
    1. Advertisements

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. homecurr@yahoo.com

    ImageIO read 16 bit unsigned short image

    homecurr@yahoo.com, Apr 18, 2004, in forum: Java
    Replies:
    1
    Views:
    1,171
    Roedy Green
    Apr 18, 2004
  2. Abhijit Bhadra
    Replies:
    2
    Views:
    7,763
    Ron Natalie
    Dec 1, 2004
  3. David Geering

    longs, long longs, short short long ints . . . huh?!

    David Geering, Jan 8, 2007, in forum: C Programming
    Replies:
    15
    Views:
    816
    Keith Thompson
    Jan 11, 2007
  4. slougheed@gmail.com

    unsigned short short?

    slougheed@gmail.com, Oct 16, 2006, in forum: C++
    Replies:
    4
    Views:
    1,085
    Kaz Kylheku
    Oct 17, 2006
  5. fancyerii
    Replies:
    21
    Views:
    2,195
    Roedy Green
    Nov 5, 2007
  6. Ioannis Vranos

    unsigned short, short literals

    Ioannis Vranos, Mar 4, 2008, in forum: C Programming
    Replies:
    5
    Views:
    933
    Eric Sosman
    Mar 5, 2008
  7. pozz
    Replies:
    12
    Views:
    1,039
    Tim Rentsch
    Mar 20, 2011
  8. Andre
    Replies:
    5
    Views:
    767
    Keith Thompson
    Jul 17, 2012
Loading...