标签:
example:
1.运算符:
1 #include<stdio.h> 2 int main(){ 3 int a , b , c ,d ; 4 a = 10; 5 b = a++;//先赋值给b,a再自增 6 c = ++a;//先加后赋值给c 7 d = 10*a++;//相当于 d=(10*a),a=a+1 8 printf("b,c,d :%d,%d,%d",b,c,d); 9 } 10 output: 11 b ,c ,d 10,12,120
2.两种方法实现交换两个变量的值
1 方法-:中间变量 2 int a=1,b=2,temp; 3 temp = a; 4 a = b ; 5 b = temp; 6 方法二: 7 int a=1,b=2; 8 a = a + b; 9 b = a - b; 10 a = a - b;
标签:
原文地址:http://www.cnblogs.com/fubinhnust/p/4185195.html