File: swap.c

package info (click to toggle)
why 2.30%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 26,916 kB
  • sloc: ml: 116,979; java: 9,376; ansic: 5,175; makefile: 1,335; sh: 531; lisp: 127
file content (10 lines) | stat: -rw-r--r-- 197 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
/*@ requires \valid_index(t,i) && \valid_index(t,j) 
  @ ensures t[i] == \old(t[j]) && t[j] == \old(t[i])
  @*/
void swap(int t[],int i,int j) {
  int tmp = t[i];
  t[i] = t[j]; 
  t[j] = tmp;
}