"Z Code Writer" is an Online Blog for Programmer & Beginner. Here, You will Find tech, Build your Programming Skills and other Programming Language Like C, C++, HTML, Java Script Java Code, Web Designing and University Of Sialkot (USKT) CGPA / GPA Calculator etc.

Sunday, 14 July 2019

Comment Statements

Comment Statements

      The comment statement are non-executable statements. They are used to add remarks or comments in a program. The C-compiler ignores the comments written in the source code. It means that comment lines are not translated into machine code.
      Comments are used to increase the readability of the program. Using comments in the source code, a user can easily understand the logic of the program. The comments also help for debugging and modify the program.
      In C-program, comments are written between the delimiters /* and */. The "/*" indicates the beginning of the comment while "*/" indicates the end of the comments and for one line used forward slash "//". The comments can be written at any place in the source program. 
      Following program uses comments.
/*   It  is  my  first  program
          Program  written  by :  Zain Shahid
          Date  when  written :      12-7-2019   */

          #include  < stdio.h >
          main ( )
          {
                    /* statement  to  print  a  message  */
                    printf ( " I Love Pakistan " ) ;
            }

      In the above program, two comments are given. First comment is at the beginning of the program and it has three lines. Similarly, second comment is used under the main() function. 
      The comments are not tokens. The compiler changes each comment into a single blank space before converting the source program into machine language. Therefore, comments do not increase the size of the executable program.

No comments:

Post a Comment

Thanks For Visiting Here...!! I will Reply you as soon as possible.