1

Question in title specified, too...

What's the difference between (DWORD), *(DWORD*), and (DWORD*)?

An example:

#include <windows.h>
#define playerpointer 0xABC12375 // example

int main()
{
    DWORD dwPlayerPtr = *(DWORD*)(playerpointer);
}

Hope you can help me...

crashmstr
  • 28,043
  • 9
  • 61
  • 79
user3036727
  • 31
  • 1
  • 3
  • The example doesn't relate to the question. What *difference* don't you understand? – Kerrek SB Nov 26 '13 at 14:04
  • 3
    Any decent C or C++ book should explain this quite clearly - there's a [handy list](http://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list) in case you don't have one. – Angew is no longer proud of SO Nov 26 '13 at 14:05
  • 1
    Which of those three do you understand? Can you explain what you think they do? If you don't know what one or more of them do, that is what you should ask about. –  Nov 26 '13 at 14:05
  • commas are used to separate lists, such as one, two, and three. Otherwise, your question makes no sense. – crashmstr Nov 26 '13 at 14:07

1 Answers1

6

DWORD is a MS-Windows data type. It is defined as

typedef unsigned long DWORD

(DWORD*) is a cast to convert a value to a pointer to a DWORD.

*(DWORD*) is then de-referencing that pointer to an actual DWORD value.

So, in your example above,

DWORD dwPlayerPtr = *(DWORD*)(playerpointer);

If we translate to "English", the statement is saying, get me the value of the DWORD variable which is stored in the location 0xABC12375.

OldProgrammer
  • 12,050
  • 4
  • 24
  • 45