POINTERS, pointers...

OK folks, this has probably been asked somewhere but when I do a search on pointers in the forum I get around 25k results, not going through all of that. Anyway, I'm following the tutorials and got to the section on Pointers, I understand the concept of a pointer and all that, but I'm getting confused on the semantics, for example, on pg 72 of the PDF on C++ Tutorial ON THIS SITE (http://www.cplusplus.com/files/tutorial.pdf), there's an example that reads:

  void increase (void* data, int psize)
      if ( psize == sizeof(char) )
         { char* pchar; pchar=(char*)data; ++(*pchar); }
      else if (psize == sizeof(int) )
         { int* pint; pint=(int*)data; ++(*pint); }

I get what the function is doing, it checks the size of the type getting passed to it since we're working with a void pointer in order to know how to dereference it and then increases the data accordingly, what's confusing to me is the type casting pchar=(char*) data and pint=(int*) data, if that's the intention here, parenthesis can also be used to change the order things get processed and the * can be used as a dereference operator, am I on the right track here? Thanks.
Last edited on
Lol, this has nothing to do with your code, but I was reading through your description and thought it was funny how you said "on pg 72 of the PDF on C++ Tutorial"

Im going to guess that there are thousands of PDF tutorials on C++, so you are kind of out of luck if you wanted us to be able to read from the same source you are reading from... :)
Topic archived. No new replies allowed.