Skip to content

Instantly share code, notes, and snippets.

@kresnasatya
Created November 5, 2020 04:14
Show Gist options
  • Save kresnasatya/c49db33b24b172076e25d9538d2e4aa0 to your computer and use it in GitHub Desktop.
Save kresnasatya/c49db33b24b172076e25d9538d2e4aa0 to your computer and use it in GitHub Desktop.
Pointer in C++
#include <iostream>
int main() {
int power = 9000;
// When * is used in declaration, it's creating a pointer
int* ptr = &power;
// When * is not used in a declaration, it's a dereference operator.
std::cout << *ptr << std::endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment