Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
C syntax
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Comments=== Text starting with the [[Lexical analysis#Token|token]] {{code|/*}} is treated as a [[comment (computer programming)|comment]] and ignored. The comment ends at the next {{code|*/}}; it can occur within expressions, and can span multiple lines. Accidental omission of the comment terminator is problematic in that the next comment's properly constructed comment terminator will be used to terminate the initial comment, and all code in between the comments will be considered as a comment. C-style comments do not nest; that is, accidentally placing a comment within a comment has unintended results: <syntaxhighlight lang=C line="GESHI_FANCY_LINE_NUMBERS"> /* This line will be ignored. /* A compiler warning may be produced here. These lines will also be ignored. The comment opening token above did not start a new comment, and the comment closing token below will close the comment begun on line 1. */ This line and the line below it will not be ignored. Both will likely produce compile errors. */ </syntaxhighlight> [[C++]] style line comments start with {{code|//}} and extend to the end of the line. This style of comment originated in [[BCPL]] and became valid C syntax in [[C99]]; it is not available in the original K&R C nor in [[ANSI C]]: <syntaxhighlight lang=C> // this line will be ignored by the compiler /* these lines will be ignored by the compiler */ x = *p/*q; /* this comment starts after the 'p' */ </syntaxhighlight>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)