Thread: What is the difference between (uchar) *p and (uchar *)p?

  1. #1
    Registered User
    Join Date
    Apr 2011
    Posts
    12

    What is the difference between (uchar) *p and (uchar *)p?

    Code:
    Hi all,
    
    Please clarify me the difference between (uchar) *p and (uchar * ) p
    Most of the time i got confused about this.
    Thanks in advance.
    
    Regards,
    Rajisankar.

  2. #2
    Registered User
    Join Date
    May 2010
    Location
    Naypyidaw
    Posts
    1,314
    (uchar)*p -> cast *p value to (uchar) type.
    (uchar*)p -> cast p to pointer to uchar.

    Don't use code tag unless it's code.

  3. #3
    Registered User
    Join Date
    Apr 2011
    Posts
    12
    Hi,

    (uchar)*p means unsigned char pointer.p points to unsigned char.
    But (uchar *) p means?Could you explain me briefly?please.
    thanks.

    Regards,
    Rajisankar.

  4. #4
    Registered User
    Join Date
    Jan 2009
    Posts
    1,485
    Read them from left to right.

    *p dereference the pointer, then the result is casted to uchar.
    In (uchar*)p, the pointer type is casted to a uchar pointer.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. UCHAR array question
    By Witchfinder in forum C Programming
    Replies: 7
    Last Post: 04-27-2009, 07:13 PM
  2. Finding whether UCHAR is empty?
    By Witchfinder in forum C Programming
    Replies: 4
    Last Post: 04-25-2009, 10:19 AM
  3. Using uchar for uint8?
    By Witchfinder in forum C Programming
    Replies: 7
    Last Post: 04-20-2009, 12:51 PM
  4. difference between char, uchar and uchar16
    By sunny_master_07 in forum C++ Programming
    Replies: 7
    Last Post: 01-07-2009, 04:47 AM
  5. 128 bit uchar array? please help
    By brooksbp in forum C Programming
    Replies: 4
    Last Post: 07-31-2008, 01:41 AM