Thursday, March 17, 2016

Comments in C language

In programming language comments are used to document the program & remind programmers of what tricky or logical things they did with the code, another use of comment is to explain or elaborate code to later generations of programmers. Comment doesn't affects program or not participate in coding.

Types of comments in C:

Generally, two types of comments are used in C.

(1) One line comment:
This comment is specified using the symbol //
Example:

// Single line cmnt 

(2) Multi line comment:
This comment is specified using the symbol /*   */
comment will start with /* and end with */
Example:

 /*         
              Mlty line cmnt 
              Here u can write anythng what u want
              U Can also find and like us on facebuook : 
              https://www.facebook.com/S3lfc0d1ng1854/
              Use multi line comments for explain your code, 
              You can also explain purpose of code,
              
           You can use comment in all language (Languages like C, C#, JAVA, PHP, .NET, ruby, perl, swift, python), ya ! syntax of comment is different in respective language...!!!
              Show / Explain your whole algorithm of your program to better understanding for you (If u want to see / make same type of code in future) and other people who'll use your code.
              Make your code useful and impressive by using comments.
              
              Even write your philosophy in comment section, because compiler is not give you error for that. [ But ya, if your will boss see it, he can give you nice surprises (may be after that surprise yo have to find new job) ]

               So, be careful whenever you are going to use comments...
               
               as you know ;)
               why I'm writeing all this non-tech things, because this is comment section ;)
               and ya no one is going to asking me for that, because I know that you are smart enough
               still if you don't understand you can contact me @S3lfc0d1ng1854 ... on facebook
*/

You can see use of comments in next examples:
Example of single line comment : How to print something in C.
Example of multi line comment :  Introduction to printf() and Scanf() Functions

No comments: