Home / C Programming / Control Structures :: Discussion

Discussion :: Control Structures

  1. What's wrong in the following statement, provided k is a variable of type int?
    for(k = 2, k <=12, k++)

  2. A.

     The increment should always be ++k .

    B.

     The variable must always be the letter i when using a for loop.

    C.

     There should be a semicolon at the end of the statement.

    D.

     The variable k can’t be initialized.

    E.

     The commas should be semicolons.

    View Answer

    Workspace

    Answer : Option E

    Explanation :

    In for loop the three statements parts are separated by two semicolons which are missing here.


Be The First To Comment