Bifalgorithm post
interviewer. I have a sharper ear towards these sorts of things. So when I'm looking for an answer there, I'm looking for like distinct characteristics that differentiate the two. Let me give you two right off the bat. Pointer can be set to null. There's a null pointer. Right? Also, pointers can be receded. So I can say pointer equals this and then pointer equals that as long as it's the same type. Yeah, makes sense. Okay. But references cannot and references need to be initialized where they're declared. Pointers, you can say int pointer P do nothing with it and then 10 lines later say P equals something. Yeah.
interviewer. I have a sharper ear towards these sorts of things. So when I'm looking for an answer there, I'm looking for like distinct characteristics that di…
Ideas in this flowchart
- Pointer vs Reference Characteristics
- Pointer Characteristics
- Can be set to null
- Can be reassigned
- Can be declared without initialization
- Reference Characteristics
- Cannot be set to null
- Cannot be reassigned
- Must be initialized where declared