Creates a lego model as a concrete example of the abstract idea. Renders a beautiful, fully 3-D digital visual display of the lego model. I love you so much, Computerphile.
@michaelkohlhaas44273 жыл бұрын
*Yes, little kiddos love it!*
@Triantalex11 күн бұрын
??
@MrSlowestD167 жыл бұрын
Oh man, I remember when I started programming in C and had trouble wrapping my head around this. Now years later it seems so trivial. You take it for granted. Great explanation.
@brendethedev28585 жыл бұрын
Man I'm watching this now and I'm having trouble. Been programming for 4 years without pointers as a hobby but now that I'm wanting to write an inturpriter I'm rushing to figure them out but just can't
@vedantganesh49544 жыл бұрын
I've just started learning pointers, but i do it in C++. A lot of my hackathons that i participate in just don't allow C, but it seems so fun :(
@MrSlowestD164 жыл бұрын
@@brendethedev2858 Write an interpreter for a higher level language then, is my recommendation. Honestly if I was creating an interpreter I'd just create my own. Normal forms of syntax and semantics for programming languages gets really complicated - there's a whole domain of computer science which focuses purely on that. So if you make up a language you can keep it simple and use your own rules. Best way to learn BNFs and how that related to syntax parsing is to start with simple languages, IMO. C is simple, but it also has a lot of nuance to it.
@MrSlowestD164 жыл бұрын
@@vedantganesh4954 Weird that they don't allow C, not sure why that would be the case. Though depending on the hackathon, I'd think C is a bad language to use anyway. Usually from what I understand they have more elaborate goals, not really systems per-se. . I would say in C++ pointers are generally easier to deal with. There's a few reasons for this, but mostly you often have references used in place of pointers, which greatly simplifies things (syntax, NULL checks, etc.), and also you're most often using pointers/references to objects (containers, such as vectors), not pointer offset arrays per-se. This means you're less liable to have to do pointer arithmetic and what-not, C++ generally tries to shield raw access like that in the std and boost libraries, so I'd say it's easier. Plus the addition of std strings goes a long way given that you don't have to do pointer manipulations for simple string manipulations.
@vedantganesh49544 жыл бұрын
@@MrSlowestD16 ah, i guess, but C is more... elegant? uncomplicated?
@VitruvianSasquatch7 жыл бұрын
Everyone complaining that their language is better and doesn't need pointers, try coding on small microcontrollers. They are useful.
@sebastianramadan83937 жыл бұрын
Please remind me, what kind of machine bytecode does a SIM card execute?
@1st_ProCactus7 жыл бұрын
Can I guess and just say ARM ?
@peterfireflylund7 жыл бұрын
SIM cards? Java bytecode, I think.
@mausmalone7 жыл бұрын
No, ARM is a legit CPU. Microcontrollers are the extremely low power sort of chips you find embedded in cheap electronics. You can program them in hobby kits like Arduino but you'll find one in just about any digital device that really can't be considered a computer. (like a watch, a computer monitor, a thermostat, etc ...)
@jimstanley_497 жыл бұрын
Exactly. I taught myself assembly for 8-bit PIC micros on a couple of somewhat simple projects at work. Manually stuffing values into memory and figuring out how to math on 16-bit numbers really helped when I went back to school and had to take C. All the type size and malloc and pointer stuff made a lot of sense because I could see shadows of how the compiler would translate my code into the type of stuff I was doing in micros. It also gave me a great appreciation for Python, where you can easily put together all sorts of list-like "structs" without having to worry about dereferencing Null or updating the start pointer. There's a lot of housekeeping *you* have to put together to keep linked lists working properly that the video only hinted at. It's nice to spend time getting work done instead of reinventing the wheel all the time. I'm not saying it's better, just that after a single class in C I was barely ready to solve intermediate problems in C, and even simple problems would probably require too much time and effort (my job description does not include programming). After teaching myself Python, I can throw together a script in 10 minutes to help analyze some data that would be pretty much impossible for me to do in C in a reasonable amount of time.
@w.m.40777 жыл бұрын
"We're gonna use lego to explain linked lists" Oh my lord I think I'm in love with this man...
@pilzfreak96624 жыл бұрын
I would give a lot to just have an hour of time to talk about computer science with professor Brailsford. Such a genious person and how freaking well he explains the stuff.
@jrajesh115 жыл бұрын
From childhood experiences most of us can relate a train as a linked list. Each train car is connected to a similar one. The data items are passengers
@grn13 жыл бұрын
That's an excellent example, not sure I've ever heard it explained that way.
@paulspl25813 жыл бұрын
great metaphor
@phanhung4852 жыл бұрын
What if that train transports both people and cargos together?
@mattbox872 жыл бұрын
@@phanhung485 Well, in each carriage you might find a list of passengers and another (different) list of cargo. Why wouldn't we just keep a list of cargo and passengers for the whole train? Well of course we would, and we did, when we were dealing with trains; but a CS list could be very, very long indeed!
@davidoconnor8224 Жыл бұрын
Damn, that's brillant..
@aplcc3233 жыл бұрын
I hope professor Brailsford is here for a lot more years so he can keep teaching us the history of computer science. It is truly an honor to be taught by such a well informed, clear person (:
@CODcanbefornoobs7 жыл бұрын
It took me a year to figure out how pointers work, I'm glad I didn't give up
@sebastianramadan83937 жыл бұрын
It can take a long time to find the right mentor... and it seems most explain it in a way that's much too confusing :) have you considered Binky pointer fun?!
@michaelkohlhaas44273 жыл бұрын
You should try harder. Didn't you notice that the code is wrong?
@w花b2 жыл бұрын
@@sebastianramadan8393 Well I think the best way to understand It best is to play around with it. Get a really simple explanation and figure out the edge cases or exceptions. It can't be done for every field but we have the chance in programming to be able to try something a 100 times. Might as well use It to its fullest
@unlokia7 жыл бұрын
The best Computerphile teacher *bar none* - happy, relaxed, enigmatic, affable, funny, and knowledgeable, incredibly articulate, not only in breadth but in extremes of depth. Sorry guys but NONE of you even get anywhere near close, (apart from Brian Kernighan.)
@Conenion7 жыл бұрын
And we now know his diet: Burgers, chips and beer. Great selection! :)
@davor127 жыл бұрын
....and thinks HTML is a programming language.
@wir87 жыл бұрын
I like Mike Pound too
@kiri1017 жыл бұрын
Agreed, with the exception of Robert Miles
@yoowon-hye92705 жыл бұрын
I love the mentioning of breadth and depth though 😂
@CharlesVanNoland7 жыл бұрын
I'm a C coder for life: I can't imagine coding without pointers, I use them for a variety of things beyond simple linked lists, but IIRC it was the linked list that I first learned how to wield them back in the 90s.
@kandysman866 жыл бұрын
You have helped me on my late in life(35) journey into coding more than any other teacher on the internet. You make these concepts accessible. Thank you.
@nateshrager5127 жыл бұрын
Intellectual older folks develop such great voices and habits of speech. So nice to listen to
@RichardEricCollins7 жыл бұрын
Great explanation, using lego is a great leaning tool. Pointers are one of C's most powerful tools.
@sebastianramadan83937 жыл бұрын
Yeh... screw procedural abstraction! Pointers make C turing complete, almost entirely by themselves! -coughs-
@MrPolluxxxx7 жыл бұрын
Pointers are powerful and all but I don't use them if I don't need to. Using an angle grinder to cut bread, you can, it's badass, but you'll probably hurt yourself.
@JulianOnions7 жыл бұрын
char ***avp = &argv; Enough to scare most programmers!
@TheMixedupstuff7 жыл бұрын
That is why I am sticking with managed languages.
@MrDiarukia7 жыл бұрын
Luckily C# can run natively without interpreter by now
@Edgerino7 жыл бұрын
avp points to a char **, which points to a char *, which points to the first byte of memory at the location that *argv points to.
@AlqGo7 жыл бұрын
Edgerino, strictly, there's no guarantee argv is a pointer.
@MrDiarukia7 жыл бұрын
Isn't the & there to make it a pointer to whatever argv represents?
@jessesullivan48117 жыл бұрын
Though all this information has been hammered into me since my freshman year at uni, I just love hearing him talk about this.
@fakhermokadem117 жыл бұрын
Please make video on C compiler and how it works.
@anant67784 жыл бұрын
that's a web series of 5 or more seasons and 10 ep in one season
@skhotzim_bacon4 жыл бұрын
Lol that would be a very long video but I'd watch it
@divanvanzyl75454 жыл бұрын
Someone should do that though
@skhotzim_bacon4 жыл бұрын
@@divanvanzyl7545 Read the documentation on the C compiler
@gumbilicious13 жыл бұрын
@@skhotzim_bacon this. It’s not mysterious and hidden, it’s openly documented. In fact, the request for a video sounds like “make a surface level non-informative short video about a subject that is incredibly detailed and intricate so I can enjoy it rather than gain deeper understanding”
@memk7 жыл бұрын
(void*) Now things get interesting
@KangJangkrik4 жыл бұрын
Me: grahhh I need to restart my brain The code: void(* resetFunc) (void) = 0; Me: ...
@Triantalex11 күн бұрын
??
@paulmann12897 жыл бұрын
It's been a long time since I mucked around in C, and pointers where always my headache, but this is the best explanation I've seen. I might actually break out the compiler again.
@JLSoftware7 жыл бұрын
He never even said what a pointer is - an integer specifying a memory location!
@sebastianramadan83937 жыл бұрын
If a pointer is an integer, then why can't you multiply and divide pointers? Think about it! Pointers may commonly use the underlying representation of an integer, but they're not a type of integer!
@TheWeepingCorpse7 жыл бұрын
Sebastian Ramadan the c++ language deliberately prevents you from multiplying\dividing a pointer because its part of the language spec, but its still stored as an unsigned integer (either 32 or 64 bits) in memory. A simple cast can be used to work around this restriction.
@alcar32sharif7 жыл бұрын
correct
@peterfireflylund7 жыл бұрын
Probably 'cause they *aren't* just integers. They are abstract references that may be *implemented* as simple integers... or they may not.
@levaChier7 жыл бұрын
They are and aren't integers. Heck even integers **aren't** integers. In the end of the day integers are just memory areas of 8, 16, 32, or 64 bits. It is then up to you to translate them to whatever you want. If you want to see 32bits as an unsigned integer, then you just have to go from base 2 to base 10. If you want to see them as a signed integer, then it's a bit more complicated, but it's the same concept. In C/C++ you can always cast types of equal length between them. So saying that a *pointer* is an *integer* is just like saying a *char* is a *uint8* or a *byte*. It's not exactly wrong, but if you want to be type-safe and write maintainable code it's not the way you should see things. That being said, I would agree that it's important to realise a pointer is indeed the stored address of memory location. I just don't like saying it's an integer because you should never manipulate a pointer as an integer.
@xOWSLA4 ай бұрын
What a lovely guy, and a beautiful way of explaining pointers. He locked me to the screen for 20 min.
@MECHANISMUS2 жыл бұрын
Explaining a simpler subject by means of a more complex subjects is a THING to behold.
@ijoynerКүн бұрын
The professor is talking about linked lists. Links might be implemented as pointers (Strachey-style CPL/C style), but they are abstractly different. Links are between logical data objects, pointers are to blocks of memory.
@Phalc0n13377 жыл бұрын
@14:30 shouldn't the long pointer from "beer" to "burger" go at the start of the "thing", similarly to the rest of the list? As I see it right now the pointer on "beer" just points to the blue lego, which itself just points on to "chips", thus not reading the string in the red lego?
@KohuGaly7 жыл бұрын
yes you are correct.
@AndrewVaca7 жыл бұрын
yes, it should
@jeffirwin78627 жыл бұрын
The more important question is why are brits bringing pizza and wine to a bbq? They could use some serious help from us yanks.
@andruloni7 жыл бұрын
I can understand bringing wine as you don't normally prepare the drinks *on* the barbecue, in case of pizza it's like taking your own glass and soda to a restaurant.
@0x04047 жыл бұрын
If the next pointer was the first value it would have technically been correct.
@morsecode92233 жыл бұрын
Clearly understood after 3 years of struggling,all thanks to you sir. Thank you.
@user-eg6xu7cr8e5 жыл бұрын
This is the most complicated explanation I've ever seen and it blows my head. I can explain pointer in two sentences: Pointer is an unsigned integer containing a memory address (or nothing - then it's null-pointer, which in most programming language means that value of pointer = 0, but sometimes it's special constant for null-pointers) . Making pointer to particular *type* is basically an information for programming language how to interpret arithmetic operations with that pointer : addition and subtraction - so that adding 1 to the pointer doesn't increase stored memory address value by 1 , but by the size of *type* .
@Nikage235 жыл бұрын
bravo!
@annieperdue61407 жыл бұрын
Immensely helpful Sir. I am a novice computer scientist and this video has probably saved me a couple of weeks or months of figuring it all out on my own!
@shivashankar286 жыл бұрын
I am a C guy and I can't live without pointers too. Pointers are a magical creatures !! A Truly magical beast
@blakethingstad2 жыл бұрын
Any time I ever see anything about C, I’m just so happy I work in C# and don’t have to deal with this silliness.
@peterdegelaen5 жыл бұрын
In my 40 year's carreer in IT, I have written programs in S/370 assembler, Macro 11 assembler, Cobol, Fortran, PL/I, RPG II, B-Code (= Sigma assembler, from the former Xerox Sigma computers), Progress (Now OpenEdge), Bash, Korn Shell, REXX, Python and, unfortunately, also in C. I have designed and written compilers, full screen editors, programming environments, printing systems, operations automation systems, backup management systems, tape library management systems, production control systems and much more. Some of the systems I wrote more than 20 years ago, are still in use today in the company I used to work for (I'm retired now) (the more recent programs are also still in use). All of the languages and environments I mentioned were manageable, ... except C. I have never been able to write a complex C program that was fool proof. And nobody of the army of C programmers I used to work with was. I cannot count the number of C-programs I had to rewrite from pure misery in some other language (often assembler for the low-level stuff, in combination with some other language) to make them fool proof. C is a design disaster. No wonder that so many systems have bugs in them.
@morfanaion4 жыл бұрын
14:56 Professor Brailsford, in keeping with your pictoral explanation, what you have done here is set the pointer for the next item in "beer" to a pointer to next in the item of "burgers". In C and C++ this is obviously possible to do, because a pointer, in the end, is, dependent on whether it's a 32 bit or 64 bit system, either 4 or 8 bytes of memory, no matter what you're pointing at. As such, a pointer to an integer and a pointer to an elaborate struct is interchangeable. In fact, and this is something that many students do not realize, when you look at the following struct: typedef struct _thing2 { int index; char something; struct _thing2 next; } THING2 a point to any real instance of THING2 will have the exact same value as a pointer to the index integer of that same instance. And a pointer to char something will be (dependent on whether int is 16 or 32 bit) exactly 2 or 4 memory addresses higher that the pointer to that instance of THINGS2 and int index. This is both the great strength and weakness of pointers in C and C++. Because, as long as you stay within the confines of the memoray allocated to your program, you can do whatever you like with this. The following code would work, would not give any problems, but still won't do what we intended with the struct: THING2 peter; peter.index = 0; peter.something = 'P'; peter.next = NULL; char * hiThere = (char *)&peter; Right now, I am taking the memory address of peter (which is the same as the memory address of peter.index) and putting it into a character pointer. Now, if use that pointer to read the data, what it will do is simply deliver me the first 8 bits of peter.index and treat it as a character.
@antonw64557 жыл бұрын
I think you did a wonderful job of introducing pointers to beginners. The only thing I would stress for data structures such as linked lists is that a programmer should *always* populate the next field of the inserted node before doing anything else.
@MPflugga7 жыл бұрын
19:32 This simple trick will solve all of your programming problems!
@SebGruch7 жыл бұрын
Yellow "pointer" is connected improperly :) It shall be connected to the base of "burger" THING, not it's 'next' field. Sorry for pointing out (sic!) such a detail :)
@MiffyNichen6 жыл бұрын
It's very important. Thanks.
@chrikrah5 жыл бұрын
I was thinking that, too. That's for confirming my suspicion.
@glarynth7 жыл бұрын
#define 😠 NULL
@comradepeter875 жыл бұрын
char* a = 😬;
@ajtan26074 жыл бұрын
This thread is 😂.
@KangJangkrik4 жыл бұрын
@E K with UTF-8 configuration, maybe
@Triantalex11 күн бұрын
??
@chamalinni5 жыл бұрын
Long ago I submitted Latin American Subtitles for this wonderful video, today I came back and noticed they are not available yet. I don't know how the process works, but I think it would be great if they can be approved and non-English speakers can also have access to this great learning material.
@lucianoosinaga29804 жыл бұрын
Latin American isn't a language tho
@cmyk89643 жыл бұрын
@@lucianoosinaga2980 It’s one of the two major dialects of Spanish, the other being Castillan, spoken in Spain. It’s like how technically American isn’t a language, but American English is very different from British English (while mutually intelligible).
@golangismyjam2 жыл бұрын
@@cmyk8964 American english is not very different at all compared to British English. The difference is a handful of words and spellings.
@hamsterjam7387 жыл бұрын
Took a look at the code. The way you indented the malloc is MAD, and I love it. I think I'm going to do the same from now on.
@mattbox872 жыл бұрын
18:52 "what I like about C is it's a nice half-way house" Yep, pretty much nailed it there! I should say I love C dearly
@ruroruro7 жыл бұрын
A great idea, to represent memory and pointers with legos, but there are a few things that could have been done better. 1) Attach char[20] or int or something that isn't explicitly a pointer as data, so that people don't confuse pointers to strings and pointers, which we are learning about. 2) Represent directionality of hoses in some way. 3) Make pointers point to memory, not to structures. (Attach the end of hose to the green breadboard) To represent, that no matter what you do to a structure, the pointers pointing TO it don't auto adjust or anything.
@octubre_lilaka3 жыл бұрын
I'm gonna try jumping down from JavaScript to C and then to C++, and this video helped me understand the usage and point of a pointer
@MobiusStrip3217 жыл бұрын
This kind of makes me happy. At the school I go to we had to deal with pointers within the first 4 weeks of the course. Not everyone gets it but hopefully this video will help those who hasn't gotten it yet. And also passing by referance instead of by value is something that was quite new that had made code a lot more cleaner. BTW trying to sort numbers in a doubly link list using an a* method is really hard but really fun. Still need to get it working
@Halesnaxlors3 жыл бұрын
A nice and concise explanation. Just what I needed to refresh. Thanks!
@code-dredd7 жыл бұрын
"You need two fingers" -Prof. Brailsford 😏
@conkerconk33 жыл бұрын
doing this sort of "lower level" memory manipulation like pointers... idk why but its so fun and awesome to do
@nonnullptrhuman5043 жыл бұрын
Agree!
@aeebeecee37373 жыл бұрын
This channel has high quality contents.
@ambitious10017 жыл бұрын
Amazing Video. Please release the next one soon. The last time I watch a video with double pointer it was Linus Torvalds on a TED talk.
@casperghst42 Жыл бұрын
I have meet people who have an MsC in Computer Science who work as developers ... who does not understand pointers and references.
@akashverma5756 Жыл бұрын
I can listen to him for hours.
@landon50307 ай бұрын
This man is amazing with his explanations
@necropola7 жыл бұрын
What I take from the video and the comments is that the world is split into people who are able to understand that a pointer is simply the address of a value and those that praise C++ as the solution to all problems.
@maxwellstrange45727 жыл бұрын
love this explanation. understanding pointers seems to be a big barrier for most beginner programmers, but this really boils it down in the same way that most CS can be boiled down: straightforward and clever once you can abstract away the syntactic constructs of something like C and use legos instead :)
@IllidanS47 жыл бұрын
Pointers are a concrete realization of a reference, the former in practice, the latter in theory.
@OpenGL4ever5 жыл бұрын
Well, in Java you don't have pointers, you call them references. And you can't do much with references in Java. They're not as powerful as pointers in C or in other words they're rather limited. You can't really do pointer arithmetic with Java references. So in my opinion, pointers and references are not really the same.
@methodinsane4 жыл бұрын
Love Computerphile. Well done guys.
@Morax5 жыл бұрын
Here I am as a grown adult trying to learn about pointers from Professor Brailsford, and all my brain can remember is "If I've named my thing, which I haven't". Me neither Professor, me neither.
@vephovandenberg31814 жыл бұрын
I think you shouldn't be afraid of pointers. It is a really powerful thing to use. And in my opinion C/C++ programmers are elite.
@CodyHoskin3 жыл бұрын
I love this guy. You can learn so much from him.
@NeuroDeveloper4 жыл бұрын
Imagine this guy on a modular synthesizer.
@asterdogma3 жыл бұрын
I am feeling quite hungry now 😁 UPDATE! (31/12/2022: just went to write the exact same thing!!)
@m4rt_2 жыл бұрын
A youtuber I watch sometimes compared pointers to street adresses, as a way of explaining how they are usefull. You can tell someone you adress to point them to where they need to go to find you, instead of literally moving the house by picking it up and putting it next to them.
@edcrypt7 жыл бұрын
You should make one (maybe not on this series) about the Actor Model of computation, that kinda inspired Smalltalk (and was inspired by it apparently too?), Scheme, and more directly influenced Erlang and the IO Language and lots of concurrency libraries for other languages. And continuing the ones on lambda calculus/the Y combinator, maybe make one on the Lambda Papers that originated Scheme? Thanks!
@codeman99-dev7 жыл бұрын
16:07 AHHHHH! You lost your list. You updated your head *before* setting next of your new thing. First rule of linked-list insertion: assign to next first! No matter where head points, the complete least should always be available.
@OpenGL4ever5 жыл бұрын
First rule: Store the address of the previous object somewhere before you swithc to the next object. Second rule: assign to next or go to previous object by using the value you stored somewhere.
@firepower012 жыл бұрын
This is such a good demonstration.
@jonathanbecker63737 жыл бұрын
That model is delightful.
@ttthttpd7 жыл бұрын
Java everything is a pointer (except primitive types ex int, long), but there is no direct pointer manipulation. So there are simultaneously pointers everywhere, and "no pointers". Also arguments are always passed by value, but those values are either pointers or primitive types which is confusing when you're learning. It's weird, but I love it so much more than C++ with its implied rather than stated storage and passing modes.
@satannstuff7 жыл бұрын
Java was designed to have "no pointers at the user end" because that's where most mistakes are made. Python does basically the same thing, though not necessarily the same way. A Python list for example is actually an array of pointers.
@OpenGL4ever5 жыл бұрын
You should take a look at Rust.
@GameCyborgCh3 жыл бұрын
i wish my professor for introductory programming (C++) used this to explain what a pointer is and how it works
@oqardZ7 жыл бұрын
I took a quick look at the code linked in the description and one thing caught my eye: #define TRUE 1 #define FALSE 0 typedef int BOOL; I would suggest to use this instead: typedef enum { false, true } bool; to define boolean type in C. If you ever move from C to C++ compiler, all the code remains the same except for the typedef line which you have to remove or comment out.
@electronicwoe7 жыл бұрын
oqardZ or just use . It can cope with c++ if it needs to.
@aeebeecee37373 жыл бұрын
The best video about pointer
@swathipai12546 жыл бұрын
@ 14:30 I think the the yellow tube(long pointer) was actually to be at the "item" thing than on the pointer.Well maybe I might be wrong though?!
@caprica92407 жыл бұрын
Prof. Brailsford mentions that it didn't occur to him to try to explain this concept (and presumably others) in lectures by using a more visual approach - which he does now with the lego. Why did it not occur to him earlier? Was it perhaps that using visualizations to teach computer science was simply considered unnecessary, or perhaps because it seemed too 'low level' and simple according to the CS culture of the time? In short, I am asking if any specific attitudes of the culture surrounding CS in past decades could have (unconsciously or otherwise) negatively influenced how new concepts were/are presented to students.
@nexusclarum80005 жыл бұрын
David Wheeler: "All problems in computer science can be solved by another level of indirection"
@XKCDism7 жыл бұрын
I never would of thought of demonstrating this idea in Lego. brilliant
@oribarmatz58406 жыл бұрын
you play lego as a child. you enjoy playing lego as a child. suddenly, adulthood strikes. you say byebye to the lego, and carry on with your life. then the passion to the lego strikes again. but you are an adult, you can not mess with those things. so you work hard all your life in order to make an excuse to play your lego again. nice job, professor, you have earned your lego back sincerely.
@philipgeorge12537 жыл бұрын
i love the idea of indentation wars
@LikelyToBeEatenByAGrue7 жыл бұрын
Philip George tabs for life
@mohammadshahabrafiq Жыл бұрын
Great video. Just ❤ Professor Brailsford. I have always thought of a pointer as a variable that stores a memory address. Like any other variable, i.e int stores an integer a pointer stores a memory address. That's how the penny dropped for me.
@zenmaster247 жыл бұрын
visual explanation is fine, but might have been nice to have the code to also illustrate the visualisation's point. that way you can see the techniques being talked about, in working code
@OpenGL4ever5 жыл бұрын
He showed the code in 1:45.
@dipi717 жыл бұрын
1:38 Each element didn’t contain a string, it did contain a *pointer to a string.*
@profdaveb63847 жыл бұрын
Yes indeed. Apologies for the slip-up .
@dancingbubbles11264 жыл бұрын
"Demon programmer," such a cool phrase.
@SjoerdTheDev7 жыл бұрын
Very interesting and nice way of visualizing!
@emmanuelokose67132 жыл бұрын
nobody is talking about his great voice
@mikesummers-smith40914 жыл бұрын
May your pointers never dangle!
@sebastianhaslinger94396 жыл бұрын
There are so many reasons for pointers. i.e. try something like this: void myStackOverflow( char[] myCopyOfJunk ) { printf("I can still handle this. "); return; } //...and feed this function with more and more data (bigger arrays). //increase this and compile again (ie. to 30000000) to see, what I mean: #define BYTES_OF_JUNK 128 int main() { char junk[BYTES_OF_JUNK]; myStackOverflow(junk); return 0; } At some point you'll get an error like: BAD_ACCESS or STACK_OVERFLOW or ... etc.
@panjak3233 жыл бұрын
I hate being traced by Google, But suggesting me a video with a topic I'm just learning, and the video's name isn't even the name of the topic. I'm stunned.
@eratonysiad25827 жыл бұрын
I just had a C exam where I had to do and know all this stuff. I blew it. Now I see this video and I'm tempted to write a letter to the head of my dept. to ask them if they could hire this guy and fire my current teacher.
@huypt77393 жыл бұрын
It is just a variable for the address. Typedef could be used instead of the cryptic c syntax
@diverfede6 жыл бұрын
his teaching is fantastic!
@Sejiko7 жыл бұрын
Is there any advantage for using pointers ? I dont get the point where pointers are necessary for any problem solving.
@jakejakeboom7 жыл бұрын
If you're familiar with a pointer-less language like Java or Python, no, there's nothing that having pointers available makes possible. The Java virtual machine and Python interpreters are relying on pointers in the background to get the expected performance, because at some level of compilation you need pointers for efficiency. But they aren't necessary when higher-level constructs (like String primitives, first-class functions, arrays, and objects) are provided. But any time you're using a Java String or a Python object or a Haskell function there are pointers being generated under the hood to keep track of data and instructions across memory. Also, it's worth knowing that primitive pointers allow for some extremely efficient algorithms that just aren't possible in higher-level languages (I think some of the non-comparison sorting algorithms).
@justice4g7 жыл бұрын
There are probably many but I recall like 20 years ago being able to speed up a C program hugely by replacing a conditional statement within a loop that called one of 2 functions with a single check before the loop which assigned a function pointer to the function to be called as it didn't need to change. People don't seem to be so obsessed with optimizing these days though.
@timn50667 жыл бұрын
When you want to pass a (huge) structure to a function, you can do it two ways. You either copy over the whole structure, modify it in the function, and then copy the whole thing back again. The other way is to just pass a single number (the pointer) and work on the original copy. The second method is way less resource intensive. A decent analogy would be the following: Say your toilet is clogged, do you then move your house over to a plumber, let him fix it and then move your whole house back to where it was? No, just just give the plumber your address and he'll come over and fix the drain.
@Mythricia19887 жыл бұрын
But most languages without explicit pointers do exactly that. They generally don't copy the structure wholecloth, they give you a reference to it, and you modify the original structure directly. It's the same thing, just less complicated to use, and it being less complicated makes it less likely that the programmer makes a mistake.
@waqar_asgar__r72947 жыл бұрын
So (conceptually at least) a linked list basically a better version of an array cuz if you wanna add (or remove) stuff from your "list" you can just create new memory and manipulate the pointers instead of all that "pushing" and "popping" in the case of arrays right?
@Improbabilities6 жыл бұрын
Linked lists are easier to manipulate, but they take up more space (each item on the list has to store a pointer to the next item). Moving through a linked list is also slower (instead of just moving to the next address in memory, you have to jump to the address stored in the pointer, which usually takes twice the time). The biggest downside of linked lists is that getting information out from the list is really slow. If you have an array stored sequentially in memory, and you want the 6th value in the list, you can calculate the exact memory location of that value (list_Pointer+5*(size_of_list_element)), and jump to the right value directly. In a linked list, you have to move through every element, which is very inefficient for big lists.
@yankomirov42906 жыл бұрын
If only my professors were like Professor Brailsford... life would be so much more easier
@0x04047 жыл бұрын
I prefer dual linked lists myself. It only requires one more pointer but you can go back to the previous item. Very nice for removing things without needing to travel all the way through the list(to find the previous item) to remove it properly.
@cigmorfil41016 жыл бұрын
Micah Chase and you can also insert by continuing the search ftom the current position in either direction
@gbbsc7 жыл бұрын
Can you do a profile video for professor Brailsford? I'd love to know more about this interesting man.
@shantanusharma56243 жыл бұрын
Thanks to learning c I understood pointers very well
@jackofnotrades154 жыл бұрын
I am not sure I am right, but I think the yellow connector @14:40 is not in the correct position, it needs to be pointing to the base of the 'new THING' and not to the next of the 'new THING'. But he did the same thing correctly when updating the head pointer. Great use of legos...😎
@jouebien7 жыл бұрын
if I'm going to write a linked list I'll make sure it uses void pointers - both the next and the stored data are void pointers. Allocate data on the heap and store a pointer to said data in the linked list. One linked list to rule them all! Year casting later on from void * to char * or int * etc is a little bit of a pain but at least I only have to maintain one data structure.
@MobiusStrip3217 жыл бұрын
JOUE BIEN TECH this is actually what we do at my school. we had to create our own library of functions and having a void *data has helped a lot with generic functions. admittedly we are only 3 months into the course so there is still much to learn.
@synestematic5 жыл бұрын
function calls to delelement at the end of main function should also be catching the return value into start pointer or you will be dereferencing a NULL pointer sooner than later.
@nap3xdnicholas_3infosec233 жыл бұрын
This was amazing, thank you sir. Cheers.
@theamjolnir96416 жыл бұрын
Thank you for the explanation this channel is awesome!
@jony77797 жыл бұрын
Great video! A bit of constructive feedback: I think theoretical computer science topics fit much better in video format than coding/programing topics.
@dreamdrifter2 жыл бұрын
Great explanation of pointers. However, 14:35 the "extra long" (yellow) pointer should be attached to the grey plate of burgers, not the "next" field (blue lego) of burgers. Pointing to the blue lego will just circumvent burgers and point straight to chips. This comment out of context though 😜
@samweldon81042 ай бұрын
We just wrote a linked list library in C a couple weeks ago in my advanced programming class, why couldn't I have stumbled onto this video a little earlier 😭 would have helped to have been picturing Legos the whole time lol
@Wanderer36392 жыл бұрын
5 years later, I barely understand what I saw but I just finished the exercise on the code.
@ayyubshaffy36124 жыл бұрын
This guys facial expressions are legendary 17:30 - 17:40