What will be the output of the program?

int main()
    int y=128;
    const int x=y;
    printf('%d\n', x);
    return 0;

A 0

B Error

C Garbage value

D 128

ANS:A - 128

Step 1: int y=128; The variable 'y' is declared as an integer type and initialized to value '128'. Step 2: const int x=y; The constant variable 'x' is declared as an integer and it is initialized with the variable 'y' value. Step 3: printf('%d\n', x); It prints the value of variable 'x'. Hence the output of the program is '128'

img not found

For help Students Orientation
Mcqs Questions

One stop destination for examination, preparation, recruitment, and more. Specially designed online test to solve all your preparation worries. Go wherever you want to and practice whenever you want, using the online test platform.