Simple C question

question marks
Image by Gerd Altmann from Pixabay

I saw this this morning and got the correct answer. I also tried it just to be sure in Visual Studio and apart from a warning, it compiled ok and ran and gave the correct answer.

#include <stdio.h>
int main() {
	float* p = (float*)50;
	p = p + 3;
	printf("%u\n", p);
}

If you want to avoid the warning, change the last line to

	printf("%u\n", (unsigned int)p);

So the question is what does this output?

  1. 53
  2. 62
  3. 66
  4. 68

Answer and explanation tomorrow.

(Visited 1 times, 1 visits today)