> >> swap(int *x,int *y)
> >> {
> >> int t;
> >> t=*x;
> >
> > Here you're dereferencing an int as a pointer,
>
> No they're not.
>
> > this is almost sure to crash your program.
>
> There's actually nothing wrong with what they're doing there - x was
> passed in as a pointer, *x yields the value of what it points to.What I meant was that they used the values of the ints as the values for the pointers from the main() body: int a=2,b=3; swap(a,b); Dereferencing that will attempt to access memory location that is not accessible to the program, thus the crash. Or am I completely misunderstanding your comment? -- Tamas Marki
