B) It prints: 2. Duh, anyone who's been paying attention in their C++ class should know this. It's like pointer 101, really. Although, I have to say, the person who wrote this question must have a twisted sense of humor. 'Attempt to compile and run' - what is this, a trick question?
Hmm, I'm going with D) It prints: 0. The code is clearly trying to confuse us with pointers and stuff, but I bet it's just a trick question and the answer is 0. You know, the classic 'return 0' at the end.
I think the answer is C) It prints: 4. When you dereference the pointer 'y', it gives you the value of 'x', which is 2. Then, you add 'x' to that, which gives you 4. Simple math, folks!
The correct answer is B) It prints: 2. The code creates a pointer variable 'y' and assigns the address of 'x' to it. Then, it prints the sum of the value of 'x' and the value pointed to by 'y', which is the value of 'x'.
Marva
1 months agoDeeanna
1 months agoKassandra
1 months agoGlenna
20 days agoTawna
1 months agoMarjory
1 months agoFidelia
2 months agoElliott
2 months agoMammie
2 months agoAlecia
1 months agoAlecia
1 months agoParis
2 months ago