C puzzles

26 03 2007

Some interesting C problems 🙂
It’s on Gowri Kumar’s page.

Here’s one of the problem:

The following C program segfaults of IA-64, but works fine on IA-32.

int main()
	int* p;
	p = (int*)malloc(sizeof(int));
	*p = 10;
	return 0;

Why does it happen so?

Check out the full article here: