Thursday, September 4, 2008

C pseudo code to reverse an integer array

/* a is the integer array and n is the size of the array */

void revIntArray(int a[], int n)
{
int i;
for(i=0;i< n/2;i++){
intSwap( &a[i], &a[n-i-1]);
}
}

//intSwap is the swap function to swap two integers

0 comments: