-
Pointer코딩 테스트/HackerRank 2021. 9. 14. 22:35
https://www.hackerrank.com/challenges/c-tutorial-pointer/problem
Pointer | HackerRank
Learn how to declare pointers and use them.
www.hackerrank.com
#include <iostream> #include <stdio.h> void update(int *a,int *b) { // Complete this function int tempSum, tempAbs; tempSum = *a + *b; tempAbs = abs(*a - *b); *a = tempSum; *b = tempAbs; } int main() { int a, b; int *pa = &a, *pb = &b; scanf("%d %d", &a, &b); update(pa, pb); printf("%d\n%d", a, b); return 0; }
'코딩 테스트 > HackerRank' 카테고리의 다른 글
For Loop (0) 2021.09.16 Functions (0) 2021.09.15 Print the Elements of a Linked List (0) 2021.09.13