Afficher un message
Vieux 04/02/2008, 23h50   #5
M.Caggiano
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Finding invalid pointers

On 4 Feb, 18:57, TDB <vnrb...@gmail.com> wrote:
> int main() {
> void *p;
>
> p=(void *)0x00000005;
>
> // Here
> printf(" %d ",* (int *)p);
>
> return 0;
> }
>
> When I executed the above code using GCC and VC++, it caused
> segmentation error and windows error..
>
> I need a condition that can find whether the pointer address will
> cause error or not..
>
> Any suggestions to construct that condition ?


In my opinion, you are wrong to use the pointer in that way. If you've
declared p with void, but after you've used then it as an int.
  Réponse avec citation
 
Page generated in 0,05619 seconds with 9 queries