Last active
December 25, 2019 01:52
-
-
Save moiz-frost/2e80a71068a2ad5e21930ba6cbd33a1e to your computer and use it in GitHub Desktop.
Basic pointer usage
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
#include <stdio.h> | |
#include <string.h> | |
int main() { | |
int val = 123; | |
int* valPtr = &val; | |
printf("address of &val = %p\n", &val); | |
printf("value of val = %d\n", val); | |
printf("value of valPtr = %p\n", valPtr); | |
printf("address of &valPtr = %p\n", &valPtr); | |
printf("dereferenced value of valPtr = %d\n", *valPtr); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment