Last active
August 24, 2022 11:28
-
-
Save EteimZ/8c1da293452682531f1eb355358311c9 to your computer and use it in GitHub Desktop.
Changing the value of a pointer via the Dereference[Indirection] operator.
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> | |
| int main(){ | |
| int x = 5; // Value x | |
| int* xPtr= &x; // A pointer to x | |
| *xPtr = 6; // Change value via indirection operator | |
| printf("The value of x is: %d\n", x); // x = 6 | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment