Comments and Variables in C



‘C’ supports the standard ‘C’ comment conventions. A one-line comment start with //; the comment includes all characters up to, but not including, the next new line character. A multi-line comment starts with ‘/*’ and ends with ‘*/’. Multi-line comments do not nest; a multi-line comment ends at the ?rst ‘*/’ after the opening ‘/*’. It is a checked compile-time error when an opened comment is not closed in a compilation unit.

Comments are not recognized inside string and character literals.

/* This is a multi-line comment */

//*/ this is one-line comment

/*// this comment ends at the end of this line, not at the end of the line above */


There are two types of variables: 1) Global Variables     2) Local Variables


A variable declared at the top level of a C program is called a global variable or global register. It is visible throughout the entire compilation unit in which it appears, and its value is preserved by inter-procedural control( call, return, cut to) that uses the native C-calling convention.


A local variable, declared in the body of a particular C-procedure, is privateto that procedure, ans it dies when the procedure returns. A declaration of a local variables may not have a kind and may not request a particular hardware register.

Related posts