21:Everything u need 2 know about pointers -Richard Buckland
Top Comments
All Comments (122)
-
really great
-
Huh? 29:16
-
@25:00 "This is private! Nothing in these walls leaves these walls!" lol...
-
Title is a misnomer. Should be 'Basics on Pointers'. Did not cover protecting array constants with 'const', pointers to multi-dimensional arrays, pointer addition (which he states), pointer compatibility, and was weak on declaring and assignment of pointers.
On the plus side, he was not boring, and did cover the basics with good visualization.
-
awesome video !
-
@UnbreakableBeast Can you clarify on the "not" part in "pointer is also not pointing to a constant value"? Do you mean, "the pointer IS pointing to a value, BUT it is not constant" or do you mean "the pointer IS NOT pointing to ANY value"? If you meant the first, like I think you do, then that would be perfectly fine pointer logic. No error would occur:
int x=5;
int* y;
int** z;
int v=0;
/*RULE: ref ~= address*/
y = &x; /*ref of x*/
z = &y; /*ref of the ref*/
v = **z; /*deref of the deref*/
-
(cont.) The second role the '*' symbol plays is as the 'dereference operator.' When applied to a variable holding an address to a memory location, say x, it means 'the value pointed to by' x. Behaviorally, this means that the value stored in the variable x, which is a memory address, is first resolved and visited. Then, assuming the address is both a legal and actual memory address, the stored value is then returned:
int x = 5;
int* y = 0; /*declaration*/
int z;
y = &x;
z = *y; /*dereference*/
-
Lastly, though I did not watch the entire lecture, in the beginning, he should have made a distinction on the '*' symbol as an operator. There are some semantics to it. That is, the '*' symbol actually plays two roles, lexically. First and foremost, when used in a variable declaration such as int* x, it serves to indicate a pointer variable declaration. More succintly, a variable that will hold an address-of/pointer-to a memory location.
-
Also, when he described indirection, he should have went a step further to explicitly point out the usefullness of the fact that it could have been ANY studen in the seat, not just Chen. Today, it could have been Chen, and another day, could have been 0, and another day, Jessica. It affords one to program, model, describe and express items or data dynamically, in a sort of data agnostic manner. This is perhaps THE most fundamental primitive construct that allows code/software to be reusable.
-
I'm going to go out on a limb here, and say that he made a major error in the trick pointer problem, and ACTUALLY intended to show the classic infinite address, deference notation:
int x = 5;
int* y = 0;
y = &*&*&*&*&*&*&*&*&*&x; /* Dereference, reference, dereference, reference, etc. Note that the variable 'y' ONLY accepts pointers/addresses, not values. It is both a logic and compile error to do otherwise. */



Holy shit this is useful. I wish my teachers were as engaged in the subject as this guy is.
LCaaroe 4 months ago 11
WOW! This guy knows how to teach.
MrAlexanderHoff 4 months ago 10