Comments in C : Comments « Language Basics « C / ANSI-C






Comments in C

/* This is a single line comment */
/*
 * This is a mult-line
 * comment.
 */
int main()
{
    /* A procedure */
    int i;      /* Comment / code line */
    char charArray[10];

    strcpy(charArray, "abc");         /* String */
    strcpy(charArray, "a\"bc");       /* String with quotation */

    charArray[0] = 'a';               /* Character */
    charArray[1] = '\'';              /* Character with escape */

    i = 3 / 2;                  /* Slash that's not a commment, divide operator */
    i = 3;                      /* Normal number */
    i = 0x123ABC;               /* Hex number */

    i = ((1 + 2) *              /* Nested () */
         (3 + 4));
    {
        int j;                  /* Nested {} */
    }
    return (0);
}



           
       








Related examples in the same category

1.One line comments