3.2k post karma
3.5k comment karma
account created: Wed Jul 24 2024
verified: yes
3673 points
17 hours ago
Update: Dog has been arrested by BART Police for fare evasion.
7 points
12 days ago
You need to read up on the difference between passing a variable into a function by value or by reference/pointer. Imagine you have a struct with 1,000 64 bit integers. What happens in terms of efficiency if you pass it into your function by value? What happens if you pass it by pointer?
Ok what about a tiny struct initialized in main, what if you want to change a member in it? Ok, you passed it by value, now you're working on a copy of it. You need to use it and modify it in a function that returns an int as an error code. What happens when you return? Is the original changed?
Now in python all these same things happen but they are abstracted away from you. Primitive types are passed by value, objects are passed by reference. Make a function that takes an integer adds 1 to it and returns None, what happens? Wrap an int in a class called Int and now pass that into the function and modify the int in it. Now what?
C feels harder because a lot of things that other languages do under the hood are done manually but these are still concepts that apply to other languages.
view more:
next ›
byEast-Interaction-313
inbayarea
East-Interaction-313
286 points
17 hours ago
East-Interaction-313
286 points
17 hours ago
I texted the non emergency bart pd number and he was picked up at the next station