question about pointers, cast
Hello, I've experience programming in C, but am new (somewhat) to C++. Please take a look at this snippet below. I haven't been active in C for a while, but would think it would work without the cast of (<type> *).
Am I remembering wrong, or, since I'm using a C++ compiler (G++, using Dev-C++), is that affecting the results?
#define BYTE unsigned char
#define ULONG unsigned long int
void POKE (ULONG *, BYTE);
BYTE PEEK (ULONG *);
int main(int argc, char *argv)
As it is, this compiles fine and works as I would expect. And for example, if I code:
this makes sense to me because I don't actually have an address of a variable for the variable reference operator &, so I should be stating p_a points to a ULONG , and not the value of 0x5000, but the cast by (ULONG *) is the address supplied.
But without the (<type> *) cast, I get an error compiling. Since I have a variable 'a' above (type int), shouldn't:
suffice? What am I missing here? Am I losing my marbles, or just rusty with this stuff?
Thanks in advance.