printswap.c 303 B

1234567891011121314151617181920212223
  1. #include <stdio.h>
  2. void swap(void *v[], int, int);
  3. int main()
  4. {
  5. char a[2];
  6. a[1]='a';
  7. a[0]='b';
  8. swap(a,0,1);
  9. printf("%c",a[0]);
  10. printf("%c",a[1]);
  11. return 0;
  12. }
  13. void swap(void *v[], int i, int j)
  14. {
  15. void *temp;
  16. temp = v[i];
  17. v[i] = v[j];
  18. v[j] = temp;
  19. }