네이버 지식인 문제
언어/c언어2018. 3. 19. 20:40
http://kin.naver.com/qna/detail.nhn?d1id=1&dirId=1040101&docId=297536290
# include <stdio.h>
void swap(char[], char[]);
int main()
{
int i;
char strV_a[7] = "D-WAR";
char strV_b[7] = "dragon";
swap(strV_a, strV_b);
return 0;
}
void swap(char paramA[], char paramB[])
{
int i;
char temp[10] = { 0, };
i = 0;
while (paramA[i] != '\0')
{
temp[i] = paramA[i];
i++;
}
i = 0;
while (paramB[i] != '\0')
{
paramA[i] = paramB[i];
i++;
}
printf("paramA => %s\n", paramA);
i = 0;
while (temp[i] != '\0')
{
paramB[i] = temp[i];
i++;
}
printf("paramB => %s\n", paramB);
}
'언어 > c언어' 카테고리의 다른 글
네이버 지식인 문제 _02 (0) | 2018.06.12 |
---|---|
네이버 지식인 문제 _01 (0) | 2018.06.12 |
naver 지식 (0) | 2018.03.17 |
네이버 풀이 (0) | 2018.03.11 |
stack (0) | 2018.03.04 |