题面
定义函数 swap,交换两个参数所指字符串的值。
//********** Specification of swap **********
void swap(char *pa, char *pb);
/* PreCondition:
pa,pb 所指字符串由英文字母组成,长度不大于 80,且长度相等。
PostCondition:
交换 pa 和 pb 所指的两个字符串的值
*/
#include <stdio.h>
//********** Specification of swap **********
void swap(char *pa, char *pb) {
}
/*******************************************************/
int main() {
char s1[81], s2[81];
scanf("%s%s", s1, s2);
swap(s1, s2);
printf("%s %s\n", s1, s2);
return 0;
}
样例
输入
swap paws
输出
paws swap