Created
April 21, 2017 18:38
-
-
Save dagolinuxoid/1fcf08b3b7d4b9916bac273d65047297 to your computer and use it in GitHub Desktop.
pointers are easy but syntax is sucks.
This file contains 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> | |
int main (void) { | |
int k = 42; | |
int *pointerToKadress; | |
pointerToKadress = &k; // an address | without asterisk | |
*pointerToKadress = 29; // a value placed at this address | go to this location and do something | |
printf("%s updated\n", *pointerToKadress == k ? "true" : "false"); // true | |
printf("%s updated|address %i\n", pointerToKadress == k ? "true" : "false", pointerToKadress); // false | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment