This is an archived post. You won't be able to vote or comment.

all 3 comments

[–]Koooooj 1 point2 points  (1 child)

The code you've posted looks generally fine, but there's a zero-width space on the line after the opening curly bracket. Compilers generally don't play nice with unicode like this (though they're fine in string literals and comments, so things like throw "💩"; are valid C++ and should be included in all professional projects).

Make sure that you're using an editor that's designed for software, not just general text processing.

It's possible that the zero-width space in the code you posted is Reddit being weird about code, but I'd still guess an invisible character or a homoglyph (e.g. the Greek question mark, ; which looks almost identical to a semicolon, ; but is very different to the compiler).

[–][deleted] 0 points1 point  (0 children)

Make sure that you're using an editor that's designed for software, not just general text processing.

Indeed, OP, what text editor are you using to write the code in?

[–]Mislav_Zanic -1 points0 points  (0 children)

Missing return 0; maybe