70.交换变量值

来源:互联网 发布:数据挖掘以什么为基础 编辑:程序博客网 时间:2024/05/29 18:01

给定程序中函数fun的功能是:交换主函数中两个变量的值。


#define _CRT_SECURE_NO_WARNINGS#include<stdio.h>int fun(int *x, int *y){int t;t = *x;*x = *y;*y = t;return 0;}int main(){int a, b;b = 8;a = 3;fun(&a, &b);printf("%d  ,%d\n", a, b);getchar();return 0;}


0 0
原创粉丝点击