교환 함수 swap 구현
#include <stdio.h>
void swap(int *a, int *b);
int main(void){
int number1=5, number2=10;
printf("numberber1 = %d\n", number1);
printf("numberber2 = %d\n", number2);
swap(&number1, &number2);
printf("numberer1 = %d\n", number1);
printf("numberber2 = %d\n\n", number2);
return 0;
}
void swap(int *a, int *b){
int temp;
temp=*a;
*a=*b;
*b=temp;
}
댓글 없음:
댓글 쓰기