C/Pointer/Pointer Long
What"s the pointer
<source lang="cpp">
- include <stdio.h>
void main() {
long num1 = 0; long num2 = 0; long *pnum = NULL; pnum = &num1; /* Get num1"s address */ *pnum = 2; /* assign 2 to num1 */ ++num2; /* Increment num2 */ num2 += *pnum; /* Add num1 to num2 */ pnum = &num2; /* Get address of num2 */ ++*pnum; /* Increment num2 indirectly */ printf ("\nnum1 = %ld num2 = %ld *pnum = %ld *pnum + num2 = %ld\n", num1, num2, *pnum, *pnum + num2);
}
</source>