C语言表达式和运算符(三)


void pound(int t);

typedef long l_int;

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

    l_int aplus,plusb;
    l_int a = 1;
    l_int b = 1;
    
    //右边先赋值左边后自增减
    aplus = a++;
    printf("aplus=%ld a=%ld\n",aplus,a);//aplus=1 a=2
    
    //右边先自增减后赋值左边
    plusb = ++b;
    printf("plusb=%ld b=%ld\n",plusb,b);//plusb=2 b=2


    
    //while表达式
    //这里如果使用 w++<21 就会变成先自增再判断
    l_int w = 0;
    //先判断后自增
    while (++w<21){
         printf("w=%ld",w);
    }
    
    
    //强转 char转int  float转int
    char cr = 'a';
    float ft = 11.33;
    pound(cr);
    pound((int)ft);
    int ii = cr;
    int ii2 = (int)ft;
    
    
    //for循环,双重表达式
    for (ii=1,ii2=1; ii<10; ii++,ii2++) {
        ;
    }
    
    
    
    //do while循环,至少执行一次,根据 while表达式是否继续循环
    do {
        printf("\nii==%d",ii);
        ii++;
    } while (ii<100);
    
    
    return 0;

}


void pound (int t)
{
    while (--t>0) {
        printf("\n%d ######",t);

    }
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值