entering in the code using "//" and "/*/*"

There are two ways to enter comments in the code.

1: Using //
2: Using /* /*

What's the difference? Could you please explain it a bit? Thanks a lot.
// makes a comment until the end of the line

/* makes a comment until the next */ symbol.

Syntax highlighting makes it more clear (comments in green):

1
2
3
4
5
6
// this is a comment.    Also a comment because same line
New line, so not a comment

/* this is a comment
new line, but still a comment
still comment */   not a comment anymore because we hit a */ symbol
Thanks a lot, Disch.

How many words or letters can placed on a single line, let's say in Dev-C++, when writing the code? If I have enabled "wrap to window" or "wrap to ruler" in the windows' wordpad, then when I read the end of the window or ruler, the cursor automatically shifts to the next line. But if no "wrap" is enabled then I would have to scroll left and right to see the text. Now suppose I have a long "cout" or "if" statement to make, then how can I do the wrapping? Is it allowed in C++. Please don't forget that I'm a beginner.

Regards
Jack
There's no limit. The IDE wrapping does not change where the actual line break is. Not unless the IDE is actually inserting line breaks (doubtful).

Though typically IDEs do not wrap because of this and other reasons.

I would recommend you disable word wrap for programming. It's kind of just a bad idea.
Hi Disch

Please check this video clip:
http://www.youtube.com/watch?v=Fz2jAz2DYjo

You see the problem I'm having. And you tell wrapping should be disabled! :)
I don't have audio on this comp so it'll have to wait until I get home from work.

Although for starters I should mention:

- You probably shouldn't have lines that long
- That if statement is ridiculous. This is much simpler:

1
2
if(r >= 'A' && r <= 'Z')
  // ... 


If you find yourself having multiple &&s or ||s, then you're doing something very wrong.
Thanks, Disch. Your method is simpler and better.
@OP: I personally don't use // except to diagnose something or insert a definite one-liner. /* .. */ is so good that you can even:
cout << "Have " << /*comments inside*/ "a line of code." << endl;
Topic archived. No new replies allowed.