C语言实现 用函数实现两个数的交换
程序员文章站
2022-10-30 20:15:23
#include
#include
int main()
{
int a, b;
int change_num(i...
#include <stdio.h> #include <stdlib.h> int main() { int a, b; int change_num(int a, int b);//声明change_num函数 printf("please enter two numbers:"); scanf("%d,%d", &a, &b); change_num(&a,&b);//调用change_num函数 printf("%d %d\n", a, b); system("pause"); return 0; } int change_num(int *px, int *py)//定义change_num函数 { int temp; temp = *px; *px = *py; *py = temp; }