int main() { int a = 5, *b, c; b = &a; printf("%d", a * *b * a + *b); return…
2024
int main()
{
int a = 5, *b, c;
b = &a;
printf("%d", a * *b * a + *b);
return (0);
}
Type '0' in the answer if there is compile time or run time error in the above code.
Answer: C. 130 — The code initializes a = 5 and assigns b to point to a, so *b = 5. The expression in printf is a * *b * a + *b. Substituting values: 5 * 5 * 5 + 5. First, 5 *…
- A.
145
- B.
177
- C.
130
- D.
150
Attempted by 215 students.
Show answer & explanation
Correct answer: C
The code initializes a = 5 and assigns b to point to a, so *b = 5. The expression in printf is a * *b * a + *b. Substituting values: 5 * 5 * 5 + 5. First, 5 * 5 * 5 = 125, then 125 + 5 = 130. The output is 130.
Loading lesson…