zoukankan      html  css  js  c++  java
  • c博客06-2019-结构体&文件

    1.本章学习总结

    1.1 学习内容总结

    结构类型定义的一般形式
    struct 结构名 {
        类型名 结构体成员名1;
        类型名 结构体成员名2;
        类型名 结构体成员名3;
            ...
        类型名 结构体成员名n;
    };
    

    赋值

    struct student{ 
    char name[20]; 
    int age; 
    char sex; 
    int weight; 
    void *attr; 
    };
    

    结构体数组排序做法

    正常的利用冒泡排序可以解决问题,若出现数字排序则如下

    void swap(struct typedef &S,struct typedef &T)
    {
          struct typedef tmp;
         if(S.scroe>T.score)
        {
            tmp=S;
           S=T;
           T=tmp;
         }
    }
    

    关于结构体指针的传递

    typedef struct{
      int a;
      int b;
      }date;
     static int intcms(void *para){
         int c = ((date *)para)->a;
         printf("c is %d
    ",c);
     }
      
     int main(int argc, char **argv)
     {
         date dates;
         dates.a = 9;
         dates.b = 2;
         intcms(&dates);
    }
    

    1.2 本章学习体会

    • 本章配合指针难度确实加大了,也由于临近考试周,代码量有所下降,课程跟不上,等空闲下来会多花时间在代码上的。
    • 代码量,因为有在打2840复习C语言,所以代码量大概在600行。

    大作业

    虽然很想做,但因为不懂的东西太多,实在写不出来。。。

  • 相关阅读:
    墙奸有感
    关于ubuntu里的fcitx
    Ubuntu 9.10 ati HD 3470 显卡驱动 搞定
    XP与Ubuntu双系统的问题
    invalid conversion from ‘__pthread_t*’ to ‘pid_t’
    Julian Day
    m的n次幂的求法
    Sublime Text 2
    在虚拟机Virtualbox安装Win8消费者版
    记一个循环的错误
  • 原文地址:https://www.cnblogs.com/hak1143704299/p/12045932.html
Copyright © 2011-2022 走看看