2 ms·
It's a lot easier to "get the address of this field in a struct" in C than in Java or Python or JavaScript.
by alisonkisk 6y ago
It's a lot easier to "get the address of this field in a struct" in C than in Java or Python or JavaScript.
- orf 6y agoNot really, but the real question is why would you need or want to in those languages?
- zem 6y agoin a lot of other languages you would be passing things by reference; the concept of an address would not be needed to implement a linked list.
- nybble41 6y agoSure, in those other languages you could just define a single-field class to wrap the reference to the next node, since you can only pass objects by reference and references themselves are (usually) not objects. Unfortunately this adds a lot of overhead, both in lines of code and runtime. Instead you would probably just use the less efficient algorithm with more special cases to work around the lack of indirect references.