Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
catadoxa4166ySo here's the next mental exercise for you: start thinking about how C pointers relate to the references used in javascript, and then start wondering about how exactly javascript is interpreted by the browser and then run on the client machine ...
It's a deep dark rabbit hole to explore. Have fun ^_^ -
That sounds good. Very important step if you want to program in C further. How did the ice break? Double Linked List?
-
Sagi021336y@DefiniteGoose well without pointers you can't store anything really, so you would be restricted to stack arrays / structs and can't modify anything passed to functions (since it must be passed by value without pointers). Pointers may be a bit finnicky at first but I they are unexpendable in the long run.
Edit: function pointers rock! -
benj8496y@catadoxa that does sound like a dark deep rabbit hole!
But I'm more interested in hardware and pointers mapped to registers mapped to gpio or buffers to devices like uart/spi/i2c or ad/da 😁
@drekhi12 have been at it for a while so... Don't give up dude!!
@RoodRallec I was watching a video about C structs and the guy sort of by mistake assigned a value directly to the memory location of the pointer...
Then I was thinking who crazy person decided to use . AND -> to access structs! Why and when to use one!! Then I was reading about functions being able to read and modify external values if provided with pointers...
And then woke up yesterday realizing how it all connected!! The reason for malloc and why it returned a pointer! The reason to pass pointers and function pointers around and how crazy freaking powerful and flexible that could be!! -
benj8496y@Hallelouia way ahead of you 😜 having done some functional programming (Elm, functional JS with redux, eLisp...) passing functions around sounds pretty natural already!
@DefiniteGoose I feel your frustration man! I've been trying to learn C with probably 5 books and a bunch of videos and tutorials!! I'm not saying that is hard, but now that it sort of makes sense... the concept is not super intuitive and in introductory C it just sounds redundant... "Why not pass the value and be done with it!?"
But taking into account the idea behind C (not writing assembly, control over memory and performance) it kind of starts making sense... And now I can't wait to put it to use, see how many CPU cycles I can save now! -
@benj nice =)
@DefiniteGoose I just love function pointers =)
Also:
https://fuckingfunctionpointers.com/...
Related Rants
-
Cyanide5Gotta love those 30 seconds of feeling of accomplishment after you solve a problem .. and before you see a new...
-
Synster9Happiness is refactoring a function with complexity > 415 to less than 15 😍🤘
-
CaptainRant10As a junior developer it's frustrating to not have the skill yet of mentally mapping data models in your head,...
This morning finally pointers to structs in C finally clicked on my mind!!!🤯
80% of the C code that puzzled me now makes sense!! 🤗
rant
accomplishment
insight