• @[email protected]
    link
    fedilink
    82
    edit-2
    8 months ago

    You would think so, but int* a, b is actually eqivalent to int* a; int b, so the asterisk actually does go with the name. Writing int* a, *b is inconsistent, so int *a, *b is the way to go.

    • @[email protected]
      link
      fedilink
      358 months ago

      When people say “pointers are hard”, they mean “I have no idea where the star goes and now an ampersand is also implicated”.

      • @T156
        link
        English
        238 months ago

        That’s the part where you give up and randomly shove/unshove symbols in until the code works.

    • @[email protected]
      link
      fedilink
      238 months ago

      While technically true, that’s also one of the worst ‘features’ of the language and I personally consider it a bug in the language. Use two lines and make it clear and correct.

    • ono
      link
      fedilink
      English
      38 months ago

      This is true in C, but not in D.