View Single Post
  #4 (permalink)  
Old February 25th, 2009, 09:10 AM
u6022 u6022 is offline
Registered User
 
Join Date: Feb 2009
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Can last < first?

Why the
Code:
(x>=0) &&
in

Code:
void Reverse(int *first,int *last)
{
  int dum;
  for(int x=0;((x>=0) && (x<=((last-first)/2)));x++)
  {
    dum=*(first+x);//store value of location first+x in dummy var
    *(first+x)=*(last-(1+x)); // set loc first+x to whats in last-x
    *(last-(1+x))=dum; // assign mem loc last-x dum
  }

}
Reply With Quote