My C++ pointers reference
In one of my C++ classes, we went over pointers and references. Because this stuff isn't second-nature to me, I made a little cheat-sheet, which is here if you'd like.
Declare a pointer
int * foo;
int foo = 5; int * bar; bar = &foo; // *bar = 5 foo = 6; // *bar = 6
int * foo; *foo = 5; *foo = 10;
int (*foo)(int int) is a function that returns an integer and takes 2 foo = min; foo = add;
char a = "foo";
Posted on .