Created
November 5, 2020 04:14
-
-
Save kresnasatya/c49db33b24b172076e25d9538d2e4aa0 to your computer and use it in GitHub Desktop.
Pointer in C++
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 <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