测试自动类型转换

#include stdio.hint main(void){char ch;//int i;float fl;fl = i = ch = C;printf(ch = %c, i = %d, fl = %2.2f\\n, ch, i, fl);

编程学习网为您整理以下代码实例,主要实现:测试自动类型转换,希望可以帮到各位朋友。

#include <stdio.h>

int main(voID){
    char ch;//
    int i;
    float fl;

    fl = i = ch = 'C';                                  
    printf("ch = %c, i = %d, fl = %2.2f\n", ch, i, fl); 
    ch = ch + 1;                                        
    i = fl + 4 * ch;                                    
    fl = 2.0 * ch + i;                                  
    printf("ch = %c, i = %d, fl = %2.2f\n", ch, i, fl); 
    ch = 107;                                          
    printf("Now ch = %c\n", ch);                        
    ch = 81.89;                                         
    printf("Now ch = %c\n", ch);                        

    return 0;
}
本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐