int b = 0;

int c = 0;

int main(int argc, const char *argv[])

{

printf("%d %d %d %d %d",b,b++,b,++b,b);

printf("%d %d %d %d %d",c,++c,c,c++,c);

return 0;

}

结果为 2 1 1 1 0   2 2 1 0 0

这个能够理解,由于printf是从后往前进行的,

而:

int main(int argc, const char *argv[])

{

    int b = 0;

    int c = 0;

printf("%d %d %d %d %d",b,b++,b,++b,b);

printf("%d %d %d %d %d",c,++c,c,c++,c);

return 0;

}

实验结果为 2 1 2 2 2 2 2 2 0 2

这是为什么?

printf与++的puzzle的更多相关文章

  1. UVA227

    步骤:1.把输入的数字和空格保存.(这里用到gets函数读取整行)2.定位空格.3.输入指令. #include<stdio.h> #include<string.h> ][] ...

  2. 搜索:DLX算法

    精确覆盖问题:在一个0-1矩阵中,选定部分行,使得每一列都有且只有一个1.求解一种选法 舞蹈链(Dance Link),也就是一个循环十字链表,可以快速的删掉和恢复某行某列 结合了舞蹈链的搜索就称作D ...

  3. POJ 3076 / ZOJ 3122 Sudoku(DLX)

    Description A Sudoku grid is a 16x16 grid of cells grouped in sixteen 4x4 squares, where some cells ...

  4. POJ 3076

    DLX算法,刚接触,是关于精确覆盖的,白书上有算法介绍. 代码模板 #include <iostream> #include <cstdio> #include <cst ...

  5. UVALive 2659 数独 DLX模板

    建图: 从1到16枚举所有的行.列上放的数. 代码: #include <iostream> #include <cstdio> #include <cstring> ...

  6. 2020.3.28-ICPC训练联盟周赛,选用试题:UCF Local Programming Contest 2016

    A.Majestic 10 签到题. #include<iostream> #include<cstdio> #include<cstring> #include& ...

  7. HDU5456 Matches Puzzle Game(DP)

    题目 Source http://acm.hdu.edu.cn/showproblem.php?pid=5456 Description As an exciting puzzle game for ...

  8. one recursive approach for 3, hdu 1016 (with an improved version) , permutations, N-Queens puzzle 分类: hdoj 2015-07-19 16:49 86人阅读 评论(0) 收藏

    one recursive approach to solve hdu 1016, list all permutations, solve N-Queens puzzle. reference: t ...

  9. poj3678 Katu Puzzle 2-SAT

    Katu Puzzle Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 6714   Accepted: 2472 Descr ...

随机推荐

  1. Java经典23结构模型的设计模式(三)------附加代理模式、适配器型号、Facade模式的差异

    本文介绍了7样的结构模型中的其余2种:轻量级.代理模式. 一.享元模式FlyWeight 享元模式比較简单且重要,在非常多场合都被用到.仅仅只是封装起来了用户看不到.其概念:运用共享内存技术最大限度的 ...

  2. Visual Studio中开发

    如何在Visual Studio中开发自己的代码生成器插件    Visual Studio是美国微软公司开发的一个基本完整的开发工具集,它包括了整个软件生命周期中所需要的大部分工具,如UML工具.代 ...

  3. x264 - open gop and closed gop

    GOP - Group of picture(影像集团),它指的是两个I帧之间的距离. Reference(基准期).  它指的是两个P帧之间的距离. 简而言之, 跨参考gop的,变open gop: ...

  4. stringstream转换CString为string出错

    使用stringstream转换CString为string时,调试时发现是CString赋给stringstream没有问题,stringstram赋给string就不行,倒也不是没有赋成功,只是赋 ...

  5. 移动端 常见问题整理 iOS下的 Fixed + Input 调用键盘的时候fixed无效问题解决方案

    使用iScroll时,input等不能输入内容的解决方法 <script> function allowFormsInIscroll(){ [].slice.call(document.q ...

  6. [SQL Server优化]善用系统监视器,确定系统瓶颈

    原文:[SQL Server优化]善用系统监视器,确定系统瓶颈 来自: http://hi.baidu.com/solorez/blog/item/f82038fa0e71b78d9e51468c.h ...

  7. Arduino 数码管LED驱动器 阵列方法

    样品谈到最后一个驱动程序LED数码管,采用了最简单的解决方案之一,对于每一个LED高低电平控制,这样的好处是每个LED控制可检.避免短路造成的错觉,因为,但是对于数字的变化是,它是多余的写,因此,这种 ...

  8. mahout安装和测试

    Mahout 是 Apache Software Foundation(ASF) 旗下的一个开源项目,提供一些可扩展的机器学习领域经典算法的实现,旨在帮助开发者更加方便快捷地创建智能应用程序.Apac ...

  9. c# Ftp下载程序源代码解析

    using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...

  10. 例如找出令人信服的权威C++中间malloc与new

    例如找出令人信服的权威C++中间malloc与new 问题: 非常多人都知道malloc与new都是用来申请空间用的,开辟空间来源于堆中. 可是在C++中却非常少用malloc去申请空间,为什么? 以 ...