#include int myfunc(int *myvar); int main() { int myint = 5; int b = 0; int error =0; int *mypointer = &myint; int myarray[] = {1,3,5,7,9}; printf("myint = %d\n", myint); /* prints the integer value of the variable*/ printf("&myint = %d\n", &myint); /* prints the address of the variable /*printf("*myint = %d\n",*myint);*/ /*This line doesn't compile - why not?*/ printf("mypointer = %d\n", mypointer); /*print the value stored in mypointer*/ printf("*mypointer = %d\n", *mypointer); /*dereference the pointer - printer the value at the address pointed to*/ printf("&mypointer = %d\n\n", &mypointer); /*print the address of the pointer, ie the actual address in memory when the pointer is stored*/ *mypointer = 456; /* deference my pointer - set the contents of the address pointed to to 456*/ printf("myint now = %d\n", myint); /* now print the contents of myint and notice the change*/ error = myfunc(&myint); /*call myfunc, and pass my int by reference*/ printf("after myfunc, myint now = %d\n", myint); /*print the new value of myint*/ return 0; } int myfunc(int *myvar) /*dereference myvar in the function*/ { *myvar = *myvar + 6; /*add 6 to the contents of the memory address stored in *myvar, then save this in the memory address at *myvar*/ return 1; }