int main()
{
int *p=NULL;
p=malloc(8);
if (p==NULL)
printf("Mem alloc failed\n");
else
printf("Passed\n");
unsigned long int i=0;
for (i=2;i<=10000;i++)
p[i]=10; // I thought as we are increasing beyond malloc size of 8 bytes there should be segmentation fault but I was wrong.
printf("p[10000]= %d %d\n",p[10000]);
free(p);
return 0;
}
for ループ カウントを
pow(2,32) ( for(i=2;i<=((pow(2,32)-1));i++))
どの場合、セグメンテーション違反が発生しますか?