   odd pointers
  I'm trying to learn GBA programming. There's something I don't understand... Is someone can explain me why there's two pointers on this instruction??*(unsigned long*) 0x4000000 = 0x403;   
  There aren't. (unsigned long*) 0x4000000 means to cast 0x4000000, an integer, to the type unsigned long *. The * in front of that means to dereference that pointer. Then you assign 0x403 to that location.   ;  this single line of code could be rewriten like so:unsigned long * ptr = 0x4000000; // ptr now points to 0x4000000 address in memory*ptr = 0x403; // store 0x403 into the memory location pointed by ptr (wich is 0x4000000).;Quote:Original post by Alpha BrainI'm trying to learn GBA programming. There's something I don't understand... Is someone can explain me why there's two pointers on this instruction??*(unsigned long*) 0x4000000 = 0x403;That's not really two pointers.  That first * is the dereferecing operator; it's telling the compiler "perform this operation on the data contained at this memory address."  The second * is part of a type cast; it's telling the compiler "treat this as a pointer to an unsigned long integer.";  ok thanks!so in other words:the first * is a dereferencing operator and the second * is a pointer?   ;Quote:Original post by Alpha Brainthe first * is a dereferencing operator and the second * is a pointer?Yes.The second * is part of a type used in a C-style cast expression: (unsigned int*).The first * is dereferencing the result of that cast.   ;Quote:Original post by Alpha Brainok thanks!so in other words:the second * is a pointer?Sort of. It indicates you are declaring a pointer to a variable of the specified type:  long myLong; //a variable of type long  long* myLongPointer; //a pointer to a variable of type long  myLongPointer = &myLong //make myLongPointer point to myLong  //if you don't know it yet: the & operator  //returns the memory-adress of a variable  //in this context ;)  long myOtherLong = *myLongPointer; //copying the value of the variable  //pointed to by myLongPointer in  //myOtherLong ;  Is it true that if a pointer isn't handle correctly it could ruin a computer? Did you ever crossed a fatal problem using pointers?I still don't get the concept quite well yet... Most of my C++ books don't elaborate very much on pointers, this is strange since pointers are reputed to be hard to understand...do you know any website explaining pointers with a better approach?Thanks!   ;Quote:Original post by Alpha BrainIs it true that if a pointer isn't handle correctly it could ruin a computer? Did you ever crossed a fatal problem using pointers?I still don't get the concept quite well yet... Most of my C++ books don't elaborate very much on pointers, this is strange since pointers are reputed to be hard to understand...do you know any website explaining pointers with a better approach?Thanks!Try This.It can't techinally ruin your computer, at the most it will crash your program telling you a segmentation fault occured.  But it if you look at it from a user's point of view (not a programmer's), it's just a "small bug".   