随笔分类 - C语言
            
    #ifdef ... #endif
    
            
            
        
摘要:#if defined(uic_OSD_RES_1920x1080)#define uim_1920toHRes(h) (h)#define uim_1080toVRes(v) (v)#elif defined(uic_OSD_RES_1366x768)#define uim_1920toHRes(h) (((h)*683)/960)#define uim_1080toVRes(v) (((v)*32)/45)#elif defined(uic_OSD_RES_960x540)#define uic_GP_COORD_SYS gpe_COOR...
        阅读全文
            
        
            
    隐式类型转换
    
            
            
        
摘要:因为 属于基本类型,在类型不匹配时,会自动隐士类型转换,这就需要 我们自己在赋值时 注意。强制类型转换:当操作数的类型不同, 而且不属于基本数据类型时,需要强制类型转换即:属于基本数据类型时,会隐士类型转换。 int device_space_amount;unsigned long long device_free_size, device_total_size;device_space_amount=((float )device_free_size/device_total_size)*100;int 。。。。= float *100 5 unsigned long l...
        阅读全文
            
        
            
    UI 中的 结构体 字符串的  初始化
    
            
            
        
            
        
摘要:就如通常说过的。结构体 除非在 定义初始化时,可以赋值,其它 情况 下 只能 使用 结构体名.成员 来赋值。字符数组,使用 strcpy 来 赋值。
        阅读全文
            
        
            
    What's the value of  i++ + i++?
    
            
            
        
摘要:What's the value of i++ + i++??It's undefined. Basically, in C and C++, if you read a variable twice in an expression where you also write it, the result is undefined. Don't do that. Another example is:v[i] = i++;Related example:f(v[i], i++);Here, the result is undefined because the orde
        阅读全文
            
        
            
    sizeof 关键字!
    
            
            
        
摘要:括号分情况是可以省略的,所以它不是函数!sizeof在计算变量 所占空间大小时,括号可以省略在计算类型大小时,括号不能省略
        阅读全文
            
        
            
    强制 类型转换
    
            
    
摘要:#include<stdio.h>intmain(){inti=0x1122;char*p;p=(char *)&i;if(*p==0x22){printf("little!!!!!!\n");}elseprintf("big!\n");}warning: assignment from incompatible pointer type分配 不匹配的指针类型所以要加强制类型转换:(char *)
        阅读全文
            
        
 
                    
                     
                    
                 
                    
                 
         浙公网安备 33010602011771号
浙公网安备 33010602011771号