Master Pointers in C: 10X Your C Coding!

preview_player
Показать описание

My other channel, join now so you're there for episode 01 of my AudioBook!

Primary Equipment (Amazon Affiliate Links):

This is a revised edit (shorter and without intro) of the video from several days ago!
As always, all content and opinions are mine only, (c) 2022 Plummer's Software LLC.
Рекомендации по теме
Комментарии
Автор

My dad taught me about pointers using index registers in assembler.

esra_erimez
Автор

You look exactly like a person who would teach me about pointers. Just like a Wizard NPC in games.

saberlite
Автор

That analogy between memory address and the address of a house is great! I used to make similar comparisons when teaching C to students and it really seemed to help make it click for them.

mossi
Автор

Dave, i have been coding in C since 1980 and have, many times, tried with variable success to explain pointers to newbies. This video is clearer and more concise then my best efforts. Going forward I'm just going to refer newbies to this. Thanks.

greg
Автор

This is the most amazingly coherent, clear and informative explanation of pointers I have seen in 14 years since I started programming in C and C++. This is beyond fantastic omg please continue. :)

johannesschneider
Автор

Hi Dave, I discovered your channel a few days ago and enjoyed some windows related vids; today I wanted to improve my understanding of C pointers and, voila, here you are again! I looked at some other tutorials, but yours is definitely the best! I really love your style! Keep up your great work; it's pure gold! ❤

tangiblewaves
Автор

i was a TA for an intro to C class, and the house example was what i used to describe pointers to people really confused about them. glad to see that you are using a similar example here! i feel that the easiest way to describe technical concepts to people who are confused about them(or have no technical experience/knowledge) is to use a real world analogy, even if it oversimplifies what is actually going on. once they understand the analogy and how it relates to the technical concept, then they can get to the nitty gritty of understanding the technical details behind the concept

yoshi
Автор

These three sentences solved the big problem I was having when learning pointers: "Depending on the size and complexity of the house structure that could be an expensive and wasteful operation. Why is it wasteful? Well because just like in real life there's no reason to bring your house to the appraiser for an appraisal the appraiser comes to you."
I was always so confused as to why you would use pointers when you could just carry the whole object around. But because it copies the entire house variable, which is often more data than a 8 byte pointer, this makes it efficient to use on any item that is larger than the size of a pointer. Thanks a ton!

SonicBlueTyphoon
Автор

Good video, Dave. I also have been working in C/C++ for about 40 years, including work for some notable compiler vendors such as C86, Zortech C++, and GCC (via Cygnus).
This was IMO an uncommonly clear and well-organized presentation. Was impressed that you had time to include pointer-to-functions in this 14-minute overview.
Perhaps you might have mentioned the precise prototype matching required to do real-world useful work involving pointer-to-functions; and in particular, how judicious use usually warrants declaring a typedef for a particular group of related pointers-to-functions.

jimwinchester
Автор

Hands down one of the best and concise explanations of pointers! It seems to all click in place after using and avoiding them all these years!!!

arf
Автор

Thanks! Very Helpful. You explained some things that C++ books that I have read have overlooked. Like The reason why we even need to use pointers to begin with. I hope to see more content like this.

scottcooper
Автор

Wow, 40 years ago I was still programming Fortran and had never heard of object oriented programming. At the time I was designing a production program to run various tests on pacemakers and since all the tests had some shared behavior (like limits checking, saving results to a database, printing results, etc.), I decided to create a large common block array that was indexed by something I called a "test number" then functions could do what they needed with just a test number. One huge advantage was that I could configure what tests to run and what limits to use and units to report with a big constant array at the top of the code. This meant that when a new test specification came out, usually all I had to do was to change the constant array and no code change was required. Later on in my career my SW boss told me I had created Object Oriented Fortran. Interesting - I was just a young "lazy" programmer trying to find a way to do more with less code to develop, debug, and validate. Also, being ADD, my brain worked faster than my fingers.

connecticutaggie
Автор

Thanks for making this video! I still remember the exact ‘ahah’ moment (two decades ago in freshman cs) when I grokked c memory (pointers, arrays, structures). Learning how c handles memory really helped me understand how computers work.

ochbad
Автор

I have always struggled with this. Dave, your explanation is the best I've ever heard and it worked for me! Like you say "it clicked"!

morrick
Автор

Thanks for your programming content! I have been a programmer for a while but nowadays information technology seems much too complex for me. I cannot code for real but I can follow your explanations and understand them. It's just I have problems memorizing them. So I consider your videos a source of sophisticated entertainment.

mathiasdreke
Автор

Wow. This made a whole lot more sense to me by the end. Thanks Dave!

JamesLatimer
Автор

Two follow-up tips:

The & (address-of operator) is used when you want to turn the address value of something into a pointer. Second, you will sometimes see that asterisk * in different places between the type and the pointer name: e.g. int* a; int * a; int *a; int (*a); ... all of these are exactly the same. The whitespace doesn't mean anything in these examples. That took me forever to understand. Just try to be consistent in code.

onejdc
Автор

You can also subtract a end pointer from a start pointer to get the length of data or string.
As for void pointer if you use the same format for all your structs then a uin64_t in the beginning can be used to identify the data type.

mrcrackerist
Автор

I recently started teaching the introduction system's programming course at my university, and this should make for a great review resource going forward, thank you for this and the many great videos!

connorhillen
Автор

Very clear introduction to the most important things about pointers.
Remember struggling a lot with those when I started using C++.

TheIllerX
visit shbcf.ru