Simply put, there are only really two thing to remember when working with pointers
& is 'the address of', the physical location in memory where something is stored.
* is 'the contents of', the value of the variable held at a memory location.
Making a pointer is done like:
This is because *i (read as 'the contents of the pointer i') is an integer.
Setting a pointer is simple too:
Code:
int i, *j;
j = &i; /* j equals the address of i */
You can manipulate the value held within a pointer location like:
Code:
int i, *j;
j = &i; /* j equals the address of i */
*j = 5; /* Set the contents of j (the value of i) to 5 */
if (i == *j) { /* Always True, both equal 5 */ }
Once you have mastered this, pointer become much easier...