I want to print the comment to a given program to be printed in console?
Is there any function and any own logic to get print the comment in a program?
e.g.
int main()
{
/* this is a comment */
}
the above program has only one comment i want to print this comment to console by a certain logic or any function ,if there is in C?
Perhaps you can invert your questions. Why not use a string (which you can print) as a comment? The point of comments is that
String literals have both of these characteristics.
Thus
(Python has a very similar convention, and this is where I get the name "docstring").
This is an awk script that can extract comments out of your sourcecode file.
Here is a Java version which extracts single line and multiline comments (not tested exhaustively).
You need to write a program that reads c source files, and identifies and prints comments within these files.