Alert icon
We're changing our privacy policy. This stuff matters.  Learn more  Dismiss

21:Everything u need 2 know about pointers -Richard Buckland

Loading...

Sign in or sign up now!
71,574
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Apr 25, 2008

(*but were afraid to ask)
Review of pointers and indirect addressing. pass by reference/pass by value. Passing arrays into functions.

3 neat things you can do with pointers:
1. pass by ref
2. dynamic data structures (to come)
3. ADTs in c (to come)

the exponential growth of doubling revisited.

magic trick where you are offered a choice - VS the importance of a good spec.

Starting to design a suduko solver. Mars bars from Hong Kong.

  • likes, 7 dislikes

Link to this comment:

Share to:

Top Comments

  • Holy shit this is useful. I wish my teachers were as engaged in the subject as this guy is.

  • WOW! This guy knows how to teach.

see all

All Comments (122)

Sign In or Sign Up now to post a comment!
  • 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. */

View all Comments »
Loading...

0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more