C pointers explained👉

  Рет қаралды 215,839

Bro Code

Bro Code

Күн бұрын

Пікірлер: 182
@mindlessmeat4055
@mindlessmeat4055 Жыл бұрын
Anytime I need to know something about programming, your channel is the first one I look for.
@HiiImChris
@HiiImChris 2 жыл бұрын
Just some advice.to truly understand this concept is a thorough way to apply it to your programs, I think it's best to take it slow. Don't feel bad, in my lecture I slowly and methodically took notes for hours on a 30 minute video to grasp the idea as a noob. It's ok to take your time, not all of us are coding gods. The only objective you should have is understanding it, and for each person that learns differently it's going to take varying time. As long as you come out with the knowledge, than your knowledge is just as effective as anybody elses.
@SK-ow4vw
@SK-ow4vw Жыл бұрын
I think that the conceptual problem about pointers begins much earlier than you might imagine. For example, let's take 'int age = 21" You said the integer 'age' has a value 21 AND an address. I then could easily say "well it also has a name 'age'. So now my question would be 'where is the string 'age' stored, where is the 'address' stored and where is the value stored.' Then I would ask 'how do you get to the actual integer value from the string 'age'? Surely to humans the string 'age' IS A POINTER to the value 21. So there is even confusion BEFORE one starts speaking about 'normal' pointers. As far as I understand it the compiler completely removes any reference to the string 'age'. Does it therefore replace the string 'age' in assembly code with the address where we can find the value 21? If so, the address that appears in the machine code IS A POINTER also to the value 21. Unfortunately we now don't have a name for it. So this whole issue for some of us needs to be cleared out of the way first before we can even start to talk about pointers. So in a nutshell: we need to know precisely what happens to the string 'age' in machine code.
@sueyourself5413
@sueyourself5413 Жыл бұрын
@@SK-ow4vw No, no we don't. It's a reference of text, not a string.
@onlyeyeno
@onlyeyeno Жыл бұрын
@@sueyourself5413 I believe You actually strengthened "*Sk-ow4vw*"s argument, by seemingly missing his point... As I read his comment, the "issue" is not if the "variable-name" (age) is a string or some other "datatype". Rather according to Sk-ow4vw the "crux" of this is the fact that when describing (and thinking about" the "concept of a variable", it has both and address, a value (held at that address) AND a "variable-Name". And so when explaining Pointers in a way that totally neglects to even mention the "handling and destiny" of the "variable name" You risk to "loose/confuse" people who think that "one step further". At least that's how I read SK-ow4vw's comment. Best regards.
@thedapperfoxtrot
@thedapperfoxtrot 6 күн бұрын
​@SK-ow4vw I'm replying to this far in the future it seems. Hopefully you found your answer by now. The string 'age' is something we see in our IDE (text editor) to differentiate all the kinds of variables of data we will store. When the compiler puts our program together and spits out machine code, it's not storing 'age', but taking the value from the variable we called 'age', and assigning it to an address. The address changes each time the program is executed. If you pause at 3:00 for example, you'll notice he's printing the address of the stored value. The SAME stored value, was placed first in ....61FE1C, but the next time in ....61FE14. Two separate executions of the same program. Do these stored values remain in memory? Only as long as the program is running (which in this case is a fraction of a second). Important note: When we speak of storing something in memory, we're referring to the fast memory (RAM), and not the more permanent storage space we typically think of (HDD or SSD). RAM is memory that is allocated and free'd during the duration of running programs, and stops being in use when a program stops running. Hope this helps!
@katarinaclaes2975
@katarinaclaes2975 9 ай бұрын
nice explanation, your tips on what's good practice makes it way easier to understand
@tybargky461
@tybargky461 2 жыл бұрын
As a CS major @ Virginia Tech, you have blessed me with a foundation that builds my confidence!
@tybargky461
@tybargky461 Жыл бұрын
@@d0ubleyouteef You go to tech?
@dinnersandvich9329
@dinnersandvich9329 Жыл бұрын
@@d0ubleyouteef what?
@graziazuccaro7489
@graziazuccaro7489 Ай бұрын
"value at address" was a gamechanger. Thank you!
@spooders8943
@spooders8943 2 жыл бұрын
this was the clearest way someone has ever explained pointers to me. thanks
@VirajPramodJadhav
@VirajPramodJadhav 2 ай бұрын
Man you're just too good. You are probably the best teacher out here. Thank you so much.
@r.n.g.8587
@r.n.g.8587 2 ай бұрын
So many people give garbage explanations of what a pointer is and what its purpose is. this is the first video that explained it in a way that I get.
@BroCodez
@BroCodez 3 жыл бұрын
#include void printAge(int *pAge) { printf("You are %d years old ", *pAge); //dereference } int main() { // pointer = a "variable-like" reference that holds a memory address to another variable, array, etc. // some tasks are performed more easily with pointers // * = indirection operator (value at address) int age = 21; int *pAge = &age; printAge(pAge); //printf("address of age: %p ", &age); //printf("value of pAge: %p ", &pAge); //printf("size of age: %d bytes ", sizeof(age)); //printf("size of pAge: %d bytes ", sizeof(pAge)); //printf("value of age: %d ", age); //printf("value at stored address: %d ", *pAge); //dereferencing return 0; }
@giaminhpham2281
@giaminhpham2281 3 жыл бұрын
can you make another code that use cin, cout pleaseee
@abhishekmaurya8330
@abhishekmaurya8330 3 жыл бұрын
Awesome sir keep it up. You have nice way of explanation
@provokator-provocateur7603
@provokator-provocateur7603 3 жыл бұрын
Great video. Can you make video about void pointers, array pointers, struct pointers as well?
@finndemoncat9379
@finndemoncat9379 6 ай бұрын
Void pointers don't have a data type reference. You can store any type of data in it and convert to other data type. Struct pointers work just like a struct variable, the main difference it's the syntax. You can also use it to dinamicaly alocate memory to create an array of pointers. I don't know what you mean by array pointer, but you can do as like (*ptr = x[y]) and it will show either the value of it or function as a substring.
@jesuschrist2029
@jesuschrist2029 5 ай бұрын
I watched several videos few months ago and did not understand a single thing, I happen to stumble across this video I completely understood everything thanks bro
@vesnapezer683
@vesnapezer683 9 ай бұрын
I love you seriously
@NataKami21
@NataKami21 6 ай бұрын
Bro code --> The best lecturer ❣
@preethi2802
@preethi2802 11 ай бұрын
Finally got a clear insight into what all these denotations in pointers mean. Thanks a ton, bro
@omarabbas6541
@omarabbas6541 Жыл бұрын
bro , you deserve more than like , comment and subscribe. You are amazing mashaAllah
@ruddysanchez-morales4519
@ruddysanchez-morales4519 2 ай бұрын
thanks for all your content it is very easy to understand!
@ajitghising8112
@ajitghising8112 11 ай бұрын
You cleared my mind about pointer with one view. Thanks a lot. I will be coming to check more videos from your channel. I’m learning c atm. Really appreciate man 🎉
@justiceessiel6123
@justiceessiel6123 Жыл бұрын
I have understood golang pointers by understand C pointers
@HeyKevinYT
@HeyKevinYT 3 ай бұрын
I wasn't paying attention and then he said "You are 21 years old" and scared the heck out of me because I am in fact 21😂
@stephensagarinojr.4170
@stephensagarinojr.4170 Жыл бұрын
I would really be glad if you'd make a video about double pointers. Many videos are on youtube but it hard to understand it. and when I watch your videos, I can understand it easily. I am so thankful for all the tutotiral you made
@A1cJ121
@A1cJ121 Жыл бұрын
A double pointer is essentially a pointer that holds the value of the memory address of another pointer. int x= 5; int *pX = &x; int **pPX = &pX;
@tyvan5973
@tyvan5973 6 ай бұрын
Thank for your sharing!
@Harshi998i
@Harshi998i 6 ай бұрын
best info on pointers out there ,
@marianaletelier3723
@marianaletelier3723 4 ай бұрын
this is what i needed to understand, just this example. Thank you very much ❤
@Astrollyth
@Astrollyth 23 күн бұрын
I've been struggling to understand pointers and I have a final exam in like 2 hours and you just made me understand pointers so easily, I love your channel bro 😭
@barsceylan4559
@barsceylan4559 2 жыл бұрын
Dude wtf!! You are a savior !!
@josephpious1422
@josephpious1422 3 ай бұрын
good explanation
@juliannafotheringham7101
@juliannafotheringham7101 Жыл бұрын
great explanation, very clear, thank you!
@lusar626
@lusar626 3 ай бұрын
good video
@Ava-x9z3n
@Ava-x9z3n 5 ай бұрын
This is super descriptive!
@FrancisAlexanderWood0
@FrancisAlexanderWood0 6 ай бұрын
Wanted to watch your video in the background and got caught up. Thank you
@dink7458
@dink7458 2 ай бұрын
I'm still struggling to see what the point of this is though. Why would you do this and not just use normal variables?
@danreysandiego
@danreysandiego Ай бұрын
you can pass a pointer through a function, and if you modify the address of the pointer, you can modify it
@ivangoncharuk607
@ivangoncharuk607 7 күн бұрын
The point will make sense more when you try to manipulate data around different functions. C is a manual memory management language so all of the stuff languages like Java does by managing your memory automatically, you do manually with these pointers.
@ironmonkey1990
@ironmonkey1990 10 ай бұрын
very nice
@naveenkumar1853
@naveenkumar1853 Жыл бұрын
Excellent😊😊😊
@SleepyAizawa69
@SleepyAizawa69 9 ай бұрын
Hey bro thank you for your smooth well explained videos!❤
@PSIwolf39
@PSIwolf39 Жыл бұрын
Here's some code I wrote using pointers: #include #include #include #include #include #include #include void addition(int firstNumber, int secondNumber, int *pResult){ *pResult = firstNumber + secondNumber; } int main(){ int firstNumber = 20; int secondNumber = 39; int result; int* pResult = &result; addition(firstNumber,secondNumber,pResult); printf("%d+%d=%d",firstNumber,secondNumber,result); }
@NNNedlog
@NNNedlog 2 жыл бұрын
your vids are always easy to follow along. Thanks a lot
@advance6846
@advance6846 8 ай бұрын
r you black gojo
@seyhaseng1077
@seyhaseng1077 3 жыл бұрын
It would be awesome if u teach or solve the problems of languages
@Frozenflames-si8ch
@Frozenflames-si8ch 9 ай бұрын
good
@literalspam6894
@literalspam6894 6 ай бұрын
had to watch this vid a couple times before i got it, very good explanation
@spencersedano
@spencersedano 2 жыл бұрын
In what situations should I use pointers?
@RJ-or8bw
@RJ-or8bw Жыл бұрын
If you need to use a lot of memory that’s not standard size. If you have a struct that contains a lot of different data types, you would use a pointer to this huge chunk of data to get it all.
@brahimkazzi5281
@brahimkazzi5281 8 ай бұрын
Thank you bro best course
@joevaghn457
@joevaghn457 9 ай бұрын
I've never really grasped why pointers are somehow really hard to understand for some people. I'm not trying to be condescending. I'm really not! It's literally a memory address. There's nothing more to think about other than type casting pointers and pointer arithmetic, imho. When using pointers, all your doing is working with the address of something that exists somewhere else in memory. Good video tho, it was really useful. I honestly find useful
@Stvbcn
@Stvbcn 8 ай бұрын
As a beginner my issues with understanding have been: - Why the need to define the type of the underlying value if we are always talking about its address? - Why confusingly re-use the asterisk for different, but associated purposes.
@joevaghn457
@joevaghn457 8 ай бұрын
@@Stvbcn ah, So the type-of-pointer thing is so that the compiler knows how many bytes to advance the pointer ( pointer arithmetic: ++, +=, etc ). The reuse-of-asterisk is just for declaration. All I care about is if the asterisk is on value, it’s a dereference, if it’s on a declaration, then it’s a pointer. I hate dealing with multidimensional pointers beyond 3 levels. That stuff is extreme lol
@bonnymich
@bonnymich 3 ай бұрын
@@joevaghn457 what i want to know is what was the point of pointers, it looks stupid to me, i could live without it...i could just declare another type of data or use another value i could do a numerous things why i needed this in my life in the end, i dont see its awesomeness
@joevaghn457
@joevaghn457 3 ай бұрын
@@bonnymich you couldn’t live without pointers. Without pointers you couldn’t address data anywhere. The CPU literally couldn’t point to anything at all, so the compiler uses “pointers” as a way to generate instructions that instruct the CPU to reference data in memory
@huzayfasyed5488
@huzayfasyed5488 2 ай бұрын
I felt this until i actually started using them. Conceptually I get it but the syntax I don't get at all
@accumulator4825
@accumulator4825 2 жыл бұрын
Could you do a Scala series? That'd be so cool
@tylersantiago3810
@tylersantiago3810 Жыл бұрын
bro, idk who you are, I don't know where you've been, idk what you do, but thank you, I love you 3000. I just watched this video and understood everything about pointers. It took my professor 3 class sessions to do so and I still didn't get it.
@sanjaykannan4549
@sanjaykannan4549 Жыл бұрын
top G
@aymanbou4847
@aymanbou4847 Жыл бұрын
The best
@jamesharland3727
@jamesharland3727 Жыл бұрын
This is really clear, thank you! Got me though a mental block I was having on Codecademy
@krateskim4169
@krateskim4169 Жыл бұрын
nice video
@finndemoncat9379
@finndemoncat9379 6 ай бұрын
Pointers are life. There are many tricks using pointers and strings along strstr and strrch. If you use any of these functions to return a pointer with the ocurrence of x string you can subtract it of the original array and get the number of chars.
@kirutheesg3957
@kirutheesg3957 2 ай бұрын
can you elaborate? i am new to pointers
@banlmao1707
@banlmao1707 5 ай бұрын
can you make a video on how you get c to output cleanly like yours on visual studio?
@freelance-writer
@freelance-writer 4 ай бұрын
Nice explanation. The disappearing/reappearing star is terrible syntax design, which is no doubt why pointers take so long to grasp.
@nocpich
@nocpich 11 ай бұрын
thanks! it helped me a lot
@ucheogordiunor4020
@ucheogordiunor4020 Жыл бұрын
Great video,can you make video on creating a simple shell in C
@Jordan-qi2dn
@Jordan-qi2dn 7 ай бұрын
In the example where you compare the sizes of the int variable and the pointer variable, why is the pointer 8 bytes and the age variable 4 bytes? Is the pointer variable larger due to it being a hexadecimal?
@LieutenantButtonMasher
@LieutenantButtonMasher 7 ай бұрын
Mental notes: 1) You declare a pointer by succeeding the data type in the variable declaration with an asterisk *. eg: int *p = NULL; 2) You can get the address of a variable by preceding it with an ampersand &. eg: '&age' gets the address to the variable age and can be stored in a pointer type variable. 3) To dereference a pointer you precede it with an asterisk in order to access the value at the stored address. 4) Always good to assign NULL to a pointer that doesn't yet have a value assigned to it.
@truejohnsolo
@truejohnsolo 2 ай бұрын
This was perfect. I get it now
@pratiknvlogs
@pratiknvlogs 2 жыл бұрын
Which compiler and IDE is best to practice programming
@icantthinkofaname5558
@icantthinkofaname5558 Жыл бұрын
i use visual studio and mingw64 for C
@danielndobe1257
@danielndobe1257 Жыл бұрын
awesome
@eeneemeenee6236
@eeneemeenee6236 Жыл бұрын
You're awesome bruh
@michiDerMatt
@michiDerMatt 7 ай бұрын
The size of the pointer depends on if its running on 32 or 64 bit architecture right?
@fadiloumarou8280
@fadiloumarou8280 2 жыл бұрын
if we declare the pointer as int *pAge; then pAge = &age does the compiler consider *pAge as a null value?
@otgateway
@otgateway 2 жыл бұрын
nope it will assign an arbitrary integer at that address
@salih.karahan
@salih.karahan 3 жыл бұрын
Elhamdülillah 🤲🏻🤲🏻 I found one video that isn't hindi english accent
@shavilagt1072
@shavilagt1072 Жыл бұрын
hocam öğrendiniz mi c'yi?
@SHOURYAAAA
@SHOURYAAAA Жыл бұрын
Lmao. The problem is with you. I wont blame Indian people just because hindi is their language and are better at programming than the people of your country.
@diversiontv777
@diversiontv777 Жыл бұрын
I hate hindi
@burstfireno1617
@burstfireno1617 Жыл бұрын
😅
@ZeReactor
@ZeReactor 11 ай бұрын
😅😂
@shervin9561
@shervin9561 Жыл бұрын
Thanks
@danegaming9080
@danegaming9080 Жыл бұрын
nice
@miltonestepario
@miltonestepario 6 ай бұрын
thank you Bro!!!!
@randerins
@randerins Жыл бұрын
Looks like heavy depression.
@Atomos_tech
@Atomos_tech 2 жыл бұрын
Thanks for the video, but there is something I am wondering about why the address is changing always when I restart the program !?
@heyaglitz
@heyaglitz 2 жыл бұрын
It's because your program won't always get assigned the same range of memory by Windows, it's normal and it's intended to be like that.
@Atomos_tech
@Atomos_tech 2 жыл бұрын
@@heyaglitz OK, thank you
@14Elijah
@14Elijah 8 ай бұрын
I prayed 😇🙏
@NoufM-ls2pv
@NoufM-ls2pv 6 ай бұрын
I love you
@amine-c3j
@amine-c3j 3 ай бұрын
THX
@lookwithme3083
@lookwithme3083 2 жыл бұрын
I have a question how can somebody make so amazing hell videos.
@izawasinsie55
@izawasinsie55 10 ай бұрын
U saved me in exams
@Nathan00at78Uuiu
@Nathan00at78Uuiu Жыл бұрын
love being a fellow bro.
@oliveroshea6752
@oliveroshea6752 3 ай бұрын
thank you!!
@Jordan-qi2dn
@Jordan-qi2dn 7 ай бұрын
This channel is good, but I think you need to structure your videos better. What I mean is that you should do a better job of separating the examples you do instead of editing previous examples for the next ones for the sake of better comprehension. More comments would also be helpful to understand what exactly you're trying to convey. Thanks for teaching me python and C though!
@hakant.5806
@hakant.5806 Жыл бұрын
Pretty useful
@redmor
@redmor 2 жыл бұрын
thanks bro
@frzy970
@frzy970 Жыл бұрын
thanks😄
@boyar3033
@boyar3033 Жыл бұрын
Thanks Biggus Chaddus
@tushar8983
@tushar8983 Жыл бұрын
way too underrated
@ameenalrawbdeh767
@ameenalrawbdeh767 7 ай бұрын
i love you
@Jashwanth.G
@Jashwanth.G 6 ай бұрын
Did bro said sit BACK relax and enjoy just like tharun kumar the fitness KZbinr
@ahiamatagabriel5696
@ahiamatagabriel5696 2 жыл бұрын
Thank You.
@stutikalan8265
@stutikalan8265 Жыл бұрын
I told my dad that I was taking a C programming course.... He offered to give me some pointers
@gustavo-rios
@gustavo-rios 2 жыл бұрын
This is a comment for the youtube algorithm
@orangejuice7247
@orangejuice7247 Жыл бұрын
it entered uncharred territory im WHEEZING
@DelilBalci
@DelilBalci Жыл бұрын
Brooo... This channel is absolutely great!
@giaminhpham2281
@giaminhpham2281 3 жыл бұрын
This video is great.
@VedanthDhagay
@VedanthDhagay Жыл бұрын
love this
@altprsn6929
@altprsn6929 Жыл бұрын
Thank you!
@我想學英文
@我想學英文 3 ай бұрын
3:05
@tybargky461
@tybargky461 2 жыл бұрын
I LOVE YOU
@Garrison86
@Garrison86 2 жыл бұрын
Leaving a random comment down below.
@issker8840
@issker8840 Жыл бұрын
thx!
@bhoumik911
@bhoumik911 Жыл бұрын
letsgo
@zer0k4ge
@zer0k4ge Жыл бұрын
Makes sense but I bet it’s difficult to apply
@alxbudn
@alxbudn 7 ай бұрын
why didnt you go through memory management
@knangurbanov2957
@knangurbanov2957 2 жыл бұрын
r u 21 years old?
@SoloRush-hl8jv
@SoloRush-hl8jv Жыл бұрын
hey ya bro
C writing files✍️
4:20
Bro Code
Рет қаралды 58 М.
you will never ask about pointers again after watching this video
8:03
Сестра обхитрила!
00:17
Victoria Portfolio
Рет қаралды 958 М.
Что-что Мурсдей говорит? 💭 #симбочка #симба #мурсдей
00:19
Une nouvelle voiture pour Noël 🥹
00:28
Nicocapone
Рет қаралды 9 МЛН
Sigma Kid Mistake #funny #sigma
00:17
CRAZY GREAPA
Рет қаралды 30 МЛН
Master Pointers in C:  10X Your C Coding!
14:12
Dave's Garage
Рет қаралды 339 М.
Pointers and dynamic memory - stack vs heap
17:26
mycodeschool
Рет қаралды 1,5 МЛН
Explaining Pointers Until I Go Insane
6:42
Mults
Рет қаралды 350 М.
Learn C memory addresses in 7 minutes 📬
7:01
Bro Code
Рет қаралды 75 М.
C structs 🏠
4:12
Bro Code
Рет қаралды 239 М.
Introduction to Pointers | C Programming Tutorial
24:42
Portfolio Courses
Рет қаралды 123 М.
C sort an array 💱
6:02
Bro Code
Рет қаралды 104 М.
Pointers in C for Absolute Beginners - Full Course
2:04:29
freeCodeCamp.org
Рет қаралды 259 М.
Сестра обхитрила!
00:17
Victoria Portfolio
Рет қаралды 958 М.