Slacker News Slacker News logo featuring a lazy sloth with a folded newspaper hat
  • top
  • new
  • show
  • ask
  • jobs
Library
← Back to context

Comment by pjc50

3 months ago

The real evil option is C: 2+"22" = 0, 4+"4" = undefined behavior and probably the value of some other variable.

3 comments

pjc50

Reply

sehansen  3 months ago

The real horror is "1d9" + 1 = 2, as does PHP: https://3v4l.org/Dn6Sm

manwe150  3 months ago

I think you meant: "22"+2 = "", and it is not UB to make the second pointer, only to use it

  • hoseja  3 months ago

    The pointer arithmetic works both ways, same as square brackets.

Slacker News

Product

  • API Reference
  • Hacker News RSS
  • Source on GitHub

Community

  • Support Ukraine
  • Equal Justice Initiative
  • GiveWell Charities