Site icon Learn Web Development & Programming, Artificial Intelligence, WordPress, Shopify Articles

Comments and Variables in C

comment-variable-in-c

Comments:

‘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 */

Variables:

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

GLOBAL 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.

LOCAL VARIABLES:

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.

Exit mobile version