• 【c学习-5】


     下表列出了c程序中常见的保留字

    转义字符常量

    #include<stdio.h>
    extern myFunction();     //全局变量储存类,对所有文件共享 
    int main(){
        
        //int x;
        
        auto int x;              //默认储存类 
        x=10;
        //printf("x=%d
    ",x); 
        register char y;           //寄存器储存类 
        printf("int size=%d
    f",sizeof(int));
    }
    
    
    
    #include<stdio.h>
    extern x;
    void myFunction(){
        printf("x=%d
    ",x);
        
    }
    #include<stdio.h>
    extern myFunction();     //全局变量储存类,对所有文件共享 
    int main(){
        
        /* 
        //int x;
        short z;
        auto int x;              //默认储存类 
        x=10;
        //printf("x=%d
    ",x); 
        register char y;           //寄存器储存类 
        printf("int size=%d
    f",sizeof(int));
        y=1>2;
        printf("%d
    ",y);
        z=(x==10)?18:19;              //条件表达式 
        
        printf("z=%d
    ",z);
    */
    struct play{
        int id:2;
        char project:4;   // 位 域 
        int age:6;    
    } xiaoming;
    xiaoming.id=2;
    printf("%d
    ",xiaoming.id);  
    struct play xiaoHong;
    xiaoHong.id=1;
    xiaoHong.project="ball";
    printf("xiaoHong.id=%d
    ",xiaoHong.id);
    printf("xiaoHong.project=c
    ",xiaoHong.project);
    
    }    
    #include<stdio.h>
    #include<string.h>
    /* 
    typedef struct totalTable{   //typedof为结构体定义别名 ; 
        int id;
        char name;
        int money;
    }Table;
    */
    int main(){
    
    
    FILE *fp;
    char buff[255];
    fp=fopen("1.txt","r") ;
    fscanf(fp,"%s",buff);
    printf("1:%s
    ",buff);
    fgets(buff,255,(FILE*)fp);
    printf("2:%s
    ",buff);
    fclose(fp);
    /*
    FILE *fp;             //定义文件指针 
    
    fp=fopen("1.txt","w+");    //以读写方式打开文件 
    fprintf(fp,"hello world
    ");   //打印和写入文件 
    fputc("hello world",fp);
    fclose(fp);
    
    */
    
        /*
        Table x;
        x.id=1;
        strcpy(x.name,"lp");
        strcpy(x.money,"30");    
        printf("x.id=%d
    ",x.id);
        printf("x.name=%s
    ",x.name);
        printf("x.money=%s
    ",x.money);
    
    */        
    }
    #include<stdio.h>
    
    #if !defined(x)  //标示符定义有判断 
        #define x "hello world" 
    #endif
    
    #define h_var(a,b)
        printf(#a " and " #b ":I love you
    ")
              //       宏延续符 
               //    #   字符常量化运算符                     
                // ##  标记粘贴运算符 
    int main(){
        printf("%s
    ",x);
        h_var(lp,pl);
        return 0;
        
    }
        
    要保持着对知识的渴求,给自己充电,不要这荒废了短暂的时光;
  • 相关阅读:
    tfs2012服务器搭建报表、门户、TFS权限设置
    遥望星空FTP文件同步工具(附源码)1.0 发布
    TortoiseGit连接gitlab,一直要求输入密码
    static、const、readonly与static readonly的区别与联系
    sql server对并发的处理乐观锁和悲观锁
    asp.net控件开发基础系列
    Sonne的健身日志(15)16周腹肌计划第四周感受
    上海新闻!
    Sonne的健身日志(9)16周腹肌计划第一周(2012.3.92012.3.15)
    Sonne的健身日志(5)
  • 原文地址:https://www.cnblogs.com/activecode/p/9486323.html
Copyright © 2020-2023  润新知