I'm used to //
to mark a single line comment from Java and Visual Studio and was surprised that this does not exist for Ansi-C. Using /* my comment */
is quite annoying. Is there any other way to mark a single line comment when using Ansi-C?
There are two ways to add comments in C: // - Single Line Comment. /*... */ - Multi-line Comment.
Single-line comments start with two forward slashes ( // ). Any text between // and the end of the line is ignored by the compiler (will not be executed).
Single-line comments allow narrative on only one line at a time. Single-line comments can begin in any column of a given line and end at a new line or carriage return. The // character sequence marks the text following it as a single-line comment.
A comment starts with a slash asterisk /* and ends with a asterisk slash */ and can be anywhere in your program. Comments can span several lines within your C program. Comments are typically added directly above the related C source code.
ANSI-C, no, but the current standard revision allows them, and has done so ever since C99.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With