Thursday, July 30, 2009

C++ language question?

Which type of comment indicator should you use if your comment exceeds a single line?








a) // comment here */








b) /* comment here */








c) // comment here








d) // comment here //





I'm 90% its c) but I'm just making sure.

C++ language question?
b) ...... it can span multiple lines whereas the " // " is limited to single line and must be repeated on every comment-line
Reply:Have taken several C++ classes, it's B if it's more than one line, C if just one.
Reply:B would be the correct answer for anything over 1 line,


C would be for a single line.





although you can just go





//this


//is


//multiple


//lines
Reply:Definitely B.
Reply:// comments a single line


/* comments a huge sections */
Reply:My software engineer husband say you can use either b or c





B if it's a paragraph or more





C if it's a few lines





D could work too, but it's not standard.
Reply:c is used if the comment is only one line.





the correct answer is b.
Reply:From what i remember of my programming days its // then the line goes green, however this must be done to each individual line of code. which is stupid, take not i did Java but i'm 90% sure its the same
Reply:It's most DEFINITELY c)





100% sure
Reply:The format in (b) is the only one which spans multiple lines. A comment opened with // is implicitly closed at the end of a line. A comment opened with /* must be explicitly closed with a */.


No comments:

Post a Comment