I’m playing with pointers in order to understand them, so i’d like to know why I can’t, for example, print the value of the address 0 (zero) and others.
#include <stdio.h>
int main()
{
int *i = 0;
int *e = (int*)0x100;
while (i <= e)
{
printf("%d\n", *i);
i++;
}
return 0;
}
This example crashes.
Access Violation…
You don’t have access to all of your memory directly, there are protected areas.
To put it simply, an access violation occurs any time an area of memory is accessed that the program doesn’t have access to.
http://blogs.technet.com/b/askperf/archive/2008/06/03/access-violation-how-dare-you.aspx