swap()1 두 원소 바꾸기 swap() #include #include using namespace std; void swap(int *a, int *b){ int temp; temp = *a; *a = *b; *b = temp;} int main(){ int x = 1, y = 2; swap(&x, &y); printf("%d %d\n", x, y); return 0;} 2014. 12. 19. 이전 1 다음 반응형