4

In Mark Wilkins' answer to Counter not giving the expected result, he has some code that looks like this:

   if (i == var4)
   {
        cout << "\n Armstrong number " << counter << ": " << var4;
        counter++;
   }

      i++;

i++ is not formatted as code, despite having the same indentation as the line directly above it (which is).

Screenshot for effect

Why is this so?

0

1 Answer 1

10

The spaces looked identical but were not. It must be indented with plain spaces, no crazy unicode or tabs.

7
  • Nice spot, thanks! 20c2 a020 c2a0 20c2 a020 692b 2b3b 0a .. .. .. i++;.
    – johnsyweb
    Feb 27, 2013 at 22:26
  • 3
    Funny thing is, using Chrome on Mac, sometimes my spacebar will insert a no-breaking space too... Perhaps I accidentally hit a modifier key somewhere. Feb 27, 2013 at 22:41
  • 2
    It happens to me too, but I don't recall hitting any modifier.
    – apaderno
    Feb 27, 2013 at 23:16
  • Tabs actually work just fine.
    – Dennis
    Feb 28, 2013 at 1:12
  • This happened to me once too -- and it was also with Chrome on the Mac. Feb 28, 2013 at 5:20
  • Nick, note that someone else reported "in Chrome on Windows 7 Pro, I copied a block of code already in the site and pasted it just below the block that I copied - doubling the size of the block". @Ernest, do you happen to remember if it was a copy & paste action for you too? And please see balpha's answer here if it ever happens again...
    – Arjan
    Mar 5, 2013 at 21:02
  • @Arjan -- I believe it was indeed copy/paste, not from within the site, but from some other app into Chrome. Mar 6, 2013 at 2:43

Not the answer you're looking for? Browse other questions tagged .