Get help on this challenge

Debugging12


Please read this explanation before attempting debugging challenges.


This C code should be getting 11, but for some reason it prints 5. What's wrong with my code?

//By BetaT
//Should return 11, what the fuck?
#include <stdio.h>
#include <string.h>

int main(int argc, char **argv)
{
	char *buf = "Hello World";
	int *ptr = (int *)buf;

	buf = ((char*)(ptr + 2)) -2;

	printf("%d", strlen(buf));
	getchar();

	return 0;
}

Downloadable source code can be found here.


You must be logged in to play.



Challenge by BetaT.