For the x++ and ++x, the difference is whether x is incremented before, or after, the statement is evaluated.
Code:
main ()
{
int x = 0;
printf ("%d\n", x); // Prints 0, of course.
// x is 0
printf ("%d\n", ++x); // Increments x, then prints x (prints 1).
// x is now 1.
printf ("%d\n", x++); // Prints x, then increments x (prints 1).
// x is now 2.
/* And now for the interesting part... */
printf ("%d\n", (x = x + 1); // Increments x, then prints x (prints 3).
// x is now 3.
return;
}
It's really trivia, but ++x performs the same way as (x = x + 1), but this is not the same as x++. I hope that isn't confusing.
x++ is something you will come to love I assure you.
I don't know if this is still the case, but at least in the past it was that x++ was a faster instruction than (x = x + 1). Not to mention it looks neater for something that comes up an awful lot in code.
As for the point of pointers.... well, this is something that I'm pretty sure you'll learn eventually, so just remember that I am only giving you one brief example. Pointers to structures are something that are used all the time really.
Code:
struct coordinates {
double x;
double y;
} coord;
main ()
{
struct coordinates * pCoord = &coord;
coordStuff (coord);
pCoordStuff (pCoord);
return;
}
I changed the structure to two doubles instead of ints to make a point. Every time coordStuff is called, you pass it a coordinate, which takes 16 bytes. Every time pCoordStuff is called, you pass it a coordinate *, which takes 4 bytes. Whatever you pass a function, that function makes a copy of and stores in memory, so pointers are generally more function-friendly than actually passing whole structures.
Finally, as for pointers to really weird stuff... well, one example I think is that stdin and stdout are treaded as pointers, and on top of that, there's pointers to functions, which qualifies as rather strange.