View Single Post
Old 05-25-2004, 12:28 AM   #1 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,530
sde is on a distinguished road
pointer question

total newb example, but i was wondering about pointers ..

please read the comments:
Code:
void swap(int *a1, int *a2)
{
  // is this next line right?
  // it seems like i should use *a1>*a2
  if(a1 > a2)
  {
    int temp;
    temp = *a1;
    *a1 = *a2;
    *a2 = temp;
  }
}
__________________
Mike
sde is offline   Reply With Quote