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
    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. 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. David Geering

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

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

    unsigned short short?

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

    unsigned short, short literals

    Ioannis Vranos, Mar 4, 2008, in forum: C Programming
    Replies:
    5
    Views:
    683
    Eric Sosman
    Mar 5, 2008
  5. pozz
    Replies:
    12
    Views:
    745
    Tim Rentsch
    Mar 20, 2011
Loading...

Share This Page