What will be the output of the program? #include<stdio.h> int main() { int y=128; const int x=y; printf("%d\n", x); return 0; }

Review the verified answer and explanation for this DemoPaper-Pakistan past-paper question on CampusFin.

What will be the output of the program? #include<stdio.h> int main() { int y=128; const int x=y; printf("%d\n", x); return 0; } Answer: 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"

Question context

This question is part of 💡 C Programming within the broader 💻 Programming subject and appears in the DemoPaper-Pakistan preparation collection. Reviewing the answer together with nearby questions helps reinforce the underlying concept and identify how it may appear in competitive exams.