taeyounkim LOG
pointer practice 3 (function to swap numbers) 본문
Career&Study/Coding Practice
pointer practice 3 (function to swap numbers)
taeyounkim 2021. 7. 8. 23:02728x90
#include <stdio.h>
void swap(int *p, int *q);
int main(void)
{
int i=1, j=2;
swap(&i, &j);
printf("%d\n", i);
printf("%d\n", j);
return 0;
}
void swap(int *p, int *q)
{
int temp;
temp = *p;
*p = *q;
*q = temp;
}
728x90
'Career&Study > Coding Practice' 카테고리의 다른 글
pointer practice 5 (function that prints how much time passed since midnight) (0) | 2021.07.08 |
---|---|
pointer practice 4 (function to print bigger integer) (0) | 2021.07.08 |
pointer practice 2 (program to find the largest and smallest elements in an array) (0) | 2021.07.07 |
pointer practice (decomposing fraction program) (0) | 2021.07.07 |
Program to display "SEVEN SEGMENT DISPLAY" (0) | 2021.07.06 |