Last active
August 29, 2015 14:01
-
-
Save aaronmoodie/40b91bd673df634bfd55 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int main(int argc, const char * argv[]) | |
{ | |
int x = 0; | |
int *pointer_to_x = &x; // * is used to do declaration (use & to get the address of x in memory) | |
*pointer_to_x = 1; // * is a dereference operator | |
//x is now equal to 1 | |
printf("*pointer_to_x points to the value %i\n", *pointer_to_x); | |
printf("pointer_to_x is located at the address %p\n\n", pointer_to_x); | |
printf("x stores the value %i\n", x); | |
printf("x is located at the address %p\n\n", &x); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment