Constants

  1. What will be the output of the following program:-

    #include
    int main()
    {
    const int a=34;
    int b=128;
    a = b;
    printf("%d\n",a);
    return 0;
    }
    1. 128
    2. 34
    3. Compiler error
    4. garbage value
  1. View Hint | View Answer | Workspace | Discuss In Forum | Report

    const is a type specifier, when used with a data type, its value cannot be modified

    Correct Option: C

    Compiler marks a as read only, any attemp to modify the value will generate compiler error.

    Report