C 练习实例47

C 语言教程 · 2019-02-21 23:43:11

题目:宏#define命令练习2。

程序分析:无。

程序源代码:

//  Created by www.codercto.com on 15/11/9.
//  Copyright © 2015年 码农教程. All rights reserved.
//

#include<stdio.h>
#define exchange(a,b) { int t;t=a;a=b;b=t;}//注意放在一行里
int main()
{
    int x=10;
    int y=20;
    printf("x=%d; y=%d\n",x,y);
    exchange(x,y);
    printf("x=%d; y=%d\n",x,y);
    return 0;
}

以上实例输出结果为:

x=10; y=20
x=20; y=10

点击查看所有 C 语言教程 文章: https://codercto.com/courses/l/17.html

查看所有标签

Elements of Information Theory

Elements of Information Theory

Thomas M. Cover、Joy A. Thomas / Wiley-Blackwell / 2006-7 / GBP 76.50

The latest edition of this classic is updated with new problem sets and material The Second Edition of this fundamental textbook maintains the book's tradition of clear, thought-provoking instr......一起来看看 《Elements of Information Theory》 这本书的介绍吧!

在线进制转换器
在线进制转换器

各进制数互转换器

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具