An overview of using pointer notation in C. Source code: github.com/portfoliocourses/c.... Check out www.portfoliocourses.com to build a portfolio that will impress employers!
Пікірлер: 31
@yassinedarbal-86834 ай бұрын
Thank you so much really, the concept of pointers and arrays was a bit blurry for me, I used to find it very tedious to fathom. Thanks to your videos I can now go ahead and use pointers easily Your channel is really a treasure for anyone interested in C
@nkonyanechristopher2 жыл бұрын
that's lesson 101 in embedded mcu programming, thanks for these videos
@PortfolioCourses2 жыл бұрын
You’re welcome Christopher! :-)
@chillydill47036 ай бұрын
I remember the first time I saw pointers, it was just mumble jumble and very abstract and hard concept to grasp. Nowadays, it's my bread and butter. This video should have been available when I started! The topic is so simple once you learned it.
@PortfolioCourses6 ай бұрын
It’s true pointers can be so tricky to learn especially as a beginner but once you do learn them they’re not so bad. :-)
@D_Ladybug2 жыл бұрын
Thank you for these videos.
@PortfolioCourses2 жыл бұрын
You’re welcome Olamide! :-)
@sandeepvk5 ай бұрын
I am still struggling to get my head around pointers. Especially the dereferencing part. For eg I declare a pointer Why do i have use * for both referencing and dereferencing a pointer ! and the &
@yigitcoban9823 Жыл бұрын
It has been awesome.
@PortfolioCourses Жыл бұрын
Excellent I'm glad to hear that! :-)
@ryanalnaser9142 жыл бұрын
whatever anything I do before or after or anything
@ryanalnaser9142 жыл бұрын
whatever before or after or anything I do or did or know or knew or anything
@ColeHartman1 Жыл бұрын
This comment is more confusing then pointers
@zizou5638 Жыл бұрын
what if I wanted to print the first value "1" using pointer notation after b++? can *(b-1) get me the value of "1" and in array notation after passing (a+1) to the function, how to get the first value of "1"?can a[-1] get me the value of "1" THANKS A LOT FOR THE VIDEOS :)
@PortfolioCourses Жыл бұрын
You're welcome! Great question, and yes, both of those should work fine. :-) This answer here speaks a bit about this: stackoverflow.com/a/3473686.
@zizou5638 Жыл бұрын
@@PortfolioCourses thank you 🙏
@PortfolioCourses Жыл бұрын
@@zizou5638 You're welcome! 🙂
@Monica-cq2hr Жыл бұрын
If it is a single dimension we can do like this....can u help me for two dimension sir by giving hint
@PortfolioCourses Жыл бұрын
I have this video on dynamically allocating a 2D array that you might be helpful Monica? :-) kzfaq.info/get/bejne/kLKTkrKh37SoYpc.html
@AxelWerner Жыл бұрын
In your example a mem address is a 8 byte long address. So an array is simply a pointer pointing to a place that contains such an address in the consequent 8 bytes. But there is somehow a type involved. A p++ results in an address+size of type, right? But where in mem is this information about of what types a pointer is?
@PortfolioCourses Жыл бұрын
It’s the compiler that maintains how large the value pointed to be the pointer is, and so it’s not really “stored in memory” so much as “in the code the compiler creates”. :-)
@AxelWerner Жыл бұрын
@@PortfolioCourses at runtime there is no compiler. yet still "somehow" the cpu knows how many bytes to "skip" when a pointer is updated to point to "the next element" in an array. That information/offset how far to jump/how far to skip must be written somewhere. i wonder how an array of say "ints" (4byte each) is organized in memory physically. somewhere there must be the information stored of WHAT TYPE the array is so the cpu knows how many bytes to skip to reach the "next element".
@PortfolioCourses Жыл бұрын
When we compile a C program that information about how any bytes to skip is put into the assembly (machine code) instructions that the CPU executes. The compiler makes those assembly instructions and it puts the information there, that’s how the CPU gets it.
@johnbode55285 ай бұрын
Nit: arrays are not pointers. Array _expressions_ are converted to pointers under most circumstances (for reasons that are too complicated to get into in a youtube comment). When you pass an array expression as a function argument, what the function actually receives is a pointer. As far as pointer arithmetic goes, the compiler simply generates code to add the right number of bytes to an address to yield the address of the next object; no metadata about types or sizes is actually stored in the executable (except maybe in a debug build).
@ryanalnaser9142 жыл бұрын
whatever anything I do or did or know or knew or did not know I did not finish the video I will finish it inshallah
@fifaham Жыл бұрын
Thank you Kevin, very good tutorial. I made nice use of pointer arithmatic in one of my projects after watching many of your videos and learned a lot from you. I used pointer arithmatic to create a wireless packet for one of my projects and expanded on it. Decimal values (for wireless commands and data) are converted into packets for wireless communications (Bluetooth and WiFi) and worked nice. Data packets are created at the transmitter and are easily managed at the receiver side. I made a video about it for hardware designers who do software, like myself. kzfaq.info/get/bejne/j82Zrb1n1dipdn0.html many thanks for your great videos.
@PortfolioCourses Жыл бұрын
You're welcome Firas, I enjoyed your video, the step-by-step explanation was very nice! :-)
@fifaham Жыл бұрын
@@PortfolioCourses Without your videos my video will not be on KZfaq. Many thanks Kevin.