- 阅读权限
- 255
- 威望
- 0 级
- 论坛币
- 2732 个
- 通用积分
- 5.6395
- 学术水平
- 48 点
- 热心指数
- 19 点
- 信用等级
- 46 点
- 经验
- 4060 点
- 帖子
- 115
- 精华
- 4
- 在线时间
- 7 小时
- 注册时间
- 2014-6-21
- 最后登录
- 2016-8-20
|
- /*
- * =====================================================================
- * Test Pre- and Postincrement Operations
- *
- * Copyright (C) 1998 by Mark Austin and David Chancogne.
- *
- * This software is provided "as is" without express or implied warranty.
- * Permission is granted to use this software on any computer system,
- * and to redistribute it freely, subject to the following restrictions:
- *
- * 1. The authors are not responsible for the consequences of use of
- * this software, even if they arise from defects in the software.
- * 2. The origin of this software must not be misrepresented, either
- * by explicit claim or by omission.
- * 3. Altered versions must be plainly marked as such, and must not
- * be misrepresented as being the original software.
- * 4. This notice is to remain intact.
- *
- * Written by : Mark Austin
- * =====================================================================
- */
- int main( void ) {
- int iCount1, iCount2;
- /* [a] : Test Postincrement Operators */
- iCount1 = 5;
- printf( "The value of iCount1 is : %4d\n", iCount1 );
- printf( "The value of iCount1++ is : %4d\n", iCount1++ );
- printf( "The value of iCount1-- is : %4d\n\n", iCount1-- );
- /* [b] : Test Preincrement Operators */
- iCount1 = 5;
- printf( "The value of iCount1 is : %4d\n", iCount1 );
- printf( "The value of ++iCount1 is : %4d\n", ++iCount1 );
- printf( "The value of --iCount1 is : %4d\n\n", --iCount1 );
- /* [c] : Test Pre- and Postincrement Operators */
- iCount2 = iCount1++;
- printf( "The value of \"iCount2 = iCount1++\" is : %4d\n", iCount2 );
- iCount2 = ++iCount1;
- printf( "The value of \"iCount2 = ++iCount1\" is : %4d\n", iCount2 );
- }
复制代码
|
|