Last active
December 11, 2015 01:29
-
-
Save y-yu/4524177 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| void swap_array(int a[], int x, int y) | |
| { | |
| int t = a[x]; | |
| a[x] = a[y]; | |
| a[y] = t; | |
| } | |
| int main() | |
| { | |
| int i; | |
| int a[]={0,1,2,3,4,5,6}; | |
| swap_array(a,3,4); | |
| for(i = 0; i < sizeof(a)/sizeof(a[0]); i++) | |
| printf("%d\n", a[i]); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment