Finally I have a valid reason to learn about memory management. It was also hella weird when encountering it.

  • ulterno@programming.dev
    link
    fedilink
    English
    arrow-up
    15
    ·
    2 days ago

    Back when I was a kid and was learning C, I used to wonder why people considered pointers hard.
    My usage of pointers was like:

    void func (int * arg1)
    {
        // do sth with arg1
    }
    int main ()
    {
        int x;
        func (&x);
        return 0;
    }
    

    I didn’t know stuff like malloc and never felt the need in any of the program logic for the little thingies I made.
    Pointers are not hard. Memory management makes it hard.

    • chunes@lemmy.world
      link
      fedilink
      arrow-up
      2
      ·
      1 day ago

      C makes them unnecessarily confusing in my opinion. In Forth they’re as simple as can be compared to C.