- 
      
 - 
        
Save liuwanwei/5712238 to your computer and use it in GitHub Desktop.  
    在做elance的C语言测试题过程中,写了一些测试代码,对不懂的语言特性进行验证,收获良多。
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | int b[] = {1,2,3,4,5}; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #include <stdio.h> | |
| #include "a.h" | |
| #include <string.h> | |
| struct abc{ | |
| int a; | |
| }Abc; | |
| #define max(a,b) ((a) >(b))? (a):(b) | |
| int main(){ | |
| extern int b[]; | |
| char a[] = "aa"; | |
| (*a)++; | |
| printf("%s\n", a); | |
| // b 在a.h中定义,也是不好的做法。 | |
| int c = sizeof(b); | |
| printf("%d", c); | |
| int cc = 1; | |
| int * j; | |
| j = &cc; | |
| //j = j *2; | |
| int num = 425; | |
| printf("\n%d", printf("%d", num)); | |
| // TODO 学习 | |
| char e = 25; | |
| e = ~e; | |
| printf("\n%d\n", e); | |
| printf("My name""Name\n"); | |
| // 只要记住:++优先级大于*即可。 | |
| char * p = "asdfgh"; | |
| *p++; | |
| printf("%s\n", p); | |
| int m = 4; | |
| float n = 4.5; | |
| printf("%.2f\n", max(m,n)); | |
| char arr[] = {'R', 'A', 'M'}; | |
| printf("%d\n", strlen(arr)); | |
| return 0; | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment