- //
- // main.c
- // HomeWork_03
- //
- // Created by 蒋伟 on 16/5/13.
- // Copyright (c) 2016年 蒋伟. All rights reserved.
- //
- #include <stdio.h>
- void printfArr(int arr[], int length);
- int main(int argc, const char * argv[]) {
- int arr[] = {2343,4325,24,546,356367,2345,2435,2436,76};
- int length = sizeof(arr)/sizeof(arr[0]);
- printfArr(arr,length);
- for(int i = 0; i < length/2; i++){
- arr[i] = arr[i] ^ arr[length-1-i];
- arr[length-1-i] = arr[length-1-i] ^ arr[i];
- arr[i] = arr[i] ^ arr[length-1-i];
- }
- printfArr(arr,length);
- return 0;
- }
- void printfArr(int arr[], int length){
- for(int i = 0; i < length; i++){
- printf("%d\t",arr[i]);
- }
- printf("\n");
- }
复制代码
|
|