Skip to content

Instantly share code, notes, and snippets.

@owner0220
Created August 27, 2014 17:46
Show Gist options
  • Save owner0220/354e104cd29af6be406b to your computer and use it in GitHub Desktop.
Save owner0220/354e104cd29af6be406b to your computer and use it in GitHub Desktop.
문제로 풀어보는 알고리즘
#include <stdio.h>
//두 변수값을 주소를 받아 변경하기
void swap(int *a, int *b)
{
int tmp;
tmp=*a;
*a=*b;
*b=tmp;
}
//배열의 두원소 바꾸기
void swap_arr(int a[], int i, int j)
{
int tmp;
tmp=arr[i];
arr[i]=arr[j];
arr[j]=tmp;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment