-
HackerRank.com Practice > C++ > Introduction > Pointerhackerrank.com 2020. 4. 17. 07:26728x90
Problem Link : https://www.hackerrank.com/challenges/c-tutorial-pointer/problem?h_r=next-challenge&h_v=zen&h_r=next-challenge&h_v=zen
#include <stdio.h> #include <stdlib.h> void update(int *a,int *b) { // Complete this function int a1 = *a + *b; *b = abs(*a - *b); *a = a1; } 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; }
728x90'hackerrank.com' 카테고리의 다른 글
HackerRank.com Practice > C++ > Introduction > Variable Sized Arrays (0) 2020.04.17 HackerRank.com Practice > C++ > Introduction > Arrays Introduction (0) 2020.04.17 HackerRank.com Practice > C++ > Introduction > Functions (0) 2020.04.17 HackerRank.com Practice > C++ > Introduction > For Loop (0) 2020.04.17 HackerRank.com Practice > C++ > Introduction > Conditional Statements (0) 2020.04.16