Skip to content

Instantly share code, notes, and snippets.

@EteimZ
Last active August 24, 2022 11:28
Show Gist options
  • Select an option

  • Save EteimZ/8c1da293452682531f1eb355358311c9 to your computer and use it in GitHub Desktop.

Select an option

Save EteimZ/8c1da293452682531f1eb355358311c9 to your computer and use it in GitHub Desktop.
Changing the value of a pointer via the Dereference[Indirection] operator.
#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