zoukankan      html  css  js  c++  java
  • i++与++i的区别和使用

    区别:

    1、对于赋值操作:eg: int a=i++;  int b=++i

    +号在前,先完成自增操作,再进行赋值;

    +号在后,先进行赋值,再完成自增操作;

    2、对单纯的自增操作: eg: for(int i=0; i<n ;i++)  或者 for(int i=0; i<n; ++i)

    则于功能而言没有影响;

    实例:

  • 相关阅读:
    SEO搜索引擎
    SEO
    编程的智慧
    ES6编程规范
    面试题集
    motto
    motto
    JS
    motto
    Linux
  • 原文地址:https://www.cnblogs.com/liwe1004/p/14507873.html
Copyright © 2011-2022 走看看