HomePortalFAQSearchMemberlistUsergroupsRegisterLog in

Share | 
 

 Comments, oh comments, where have you gone?

Go down 
AuthorMessage
The Fellow
Admin
avatar

Posts : 100
Join date : 2010-04-28
Age : 26
Location : In my head, dreaming up how to shake up the world

PostSubject: Comments, oh comments, where have you gone?   Wed Oct 13, 2010 7:32 pm

In C (And many other languages) you can have something in your program called a comment. There is two ways to do so.

One way is to do a block comment, good for many lines of code, which is done by:
Code:

/* comment
comment comment
comment comment comment
comment
*/
Simple no? Begin the comment with a /* end it with a */, it is like the two was made for eachother!

The other way a comment can be born is a line comment, which can be put besides a line of code, or what not. good for short messages.
Code:
//comment
Wait, what? that is somewhat simaliar to what we arleady did! just instead of a * there is another /!


Now, before I end this, I want to stress commenting is KEY when it comes to working on programs with others, heck, even yourself if you ever want to edit your code again, and do not want to encounter bugs because you deleted the wrong line!


Last edited by The Fellow on Wed Oct 13, 2010 9:11 pm; edited 1 time in total
Back to top Go down
View user profile http://compilecrazy.forumotion.net
Excimer Sun Software

avatar

Posts : 152
Join date : 2010-05-07
Age : 26
Location : USA

PostSubject: Re: Comments, oh comments, where have you gone?   Wed Oct 13, 2010 8:40 pm

Everyone reading this; this is an absolutely essential thing to remember! Very good, Fellow! Just one thing, the single-line comment is just a double-slash to begin the comment and the comment then goes from there to the end of that line of code, no double-slash needed on the end. Mad
Back to top Go down
View user profile
The Fellow
Admin
avatar

Posts : 100
Join date : 2010-04-28
Age : 26
Location : In my head, dreaming up how to shake up the world

PostSubject: Re: Comments, oh comments, where have you gone?   Wed Oct 13, 2010 8:49 pm

lol, well, it happens, I am used to putting one at the end, because it helps me seperate things in my head, thinks for showing that.
Back to top Go down
View user profile http://compilecrazy.forumotion.net
Excimer Sun Software

avatar

Posts : 152
Join date : 2010-05-07
Age : 26
Location : USA

PostSubject: Re: Comments, oh comments, where have you gone?   Wed Oct 13, 2010 8:56 pm

Lol, understandable! Want me to fix it for you? xD
Back to top Go down
View user profile
The Fellow
Admin
avatar

Posts : 100
Join date : 2010-04-28
Age : 26
Location : In my head, dreaming up how to shake up the world

PostSubject: Re: Comments, oh comments, where have you gone?   Wed Oct 13, 2010 9:11 pm

lol, nahh
Back to top Go down
View user profile http://compilecrazy.forumotion.net
Excimer Sun Software

avatar

Posts : 152
Join date : 2010-05-07
Age : 26
Location : USA

PostSubject: Re: Comments, oh comments, where have you gone?   Wed Oct 13, 2010 9:16 pm

Yep, you got it. Laughing
Back to top Go down
View user profile
Sponsored content




PostSubject: Re: Comments, oh comments, where have you gone?   

Back to top Go down
 
Comments, oh comments, where have you gone?
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Compile Crazy :: Programming :: C Family :: C :: For Beginners-
Jump to: