zoukankan      html  css  js  c++  java
  • 好思路

     1 void Rotation_rules(int Preinstall_Series_Num, int Alternate_rule_num, Alternate_Rule_Struct *Alternate_rule, Preinstall_Work_Series_Struct *Preinstall_work_series, 
     2                     link_list_before_struct **link_list_before, link_list_behind_struct **link_list_behind)
     3 {
     4     int i = 0, j = 0, k = 0, n = 0;
     5     int count_before = 0, count_behind = 0;
     6 
     7     (*link_list_before) = (link_list_before_struct *)calloc(Preinstall_Series_Num, sizeof(link_list_before_struct));
     8     (*link_list_behind) = (link_list_behind_struct *)calloc(Preinstall_Series_Num, sizeof(link_list_behind_struct));
     9     
    10     for(k = 0; k < Preinstall_Series_Num; k++)
    11     {   
    12         count_before = 0;
    13         count_behind = 0;
    14         strcpy((*link_list_before)[k].banxi, Preinstall_work_series[k].Series_Name);
    15         strcpy((*link_list_behind)[k].banxi, Preinstall_work_series[k].Series_Name);
    16         (*link_list_before)[k].before = (char(*)[BANXI_LEN])calloc((count_before + 1), sizeof(char[BANXI_LEN]));
    17         (*link_list_behind)[k].behind = (char(*)[BANXI_LEN])calloc((count_behind + 1), sizeof(char[BANXI_LEN]));//预先分配一个空间
    18         for(i = 0; i < Alternate_rule_num; i++)
    19         {
    20             for(j = 0; j < Alternate_rule[i].Num_Alternate_rule_list; j++)
    21             {
    22                if(0 == strcmp(Alternate_rule[i].Alternate_rule_list[j].Next_Banxi, (*link_list_before)[k].banxi))
    23                {
    24                    strcpy((*link_list_before)[k].before + count_before, Alternate_rule[i].Alternate_rule_list[j].Banxi);
    25                    count_before++;
    26                    (*link_list_before)[k].before = (char(*)[BANXI_LEN])realloc((*link_list_before)[k].before, (count_before + 1) * sizeof(char[BANXI_LEN]));
    27                    memset((*link_list_before)[k].before + count_before, 0x0, BANXI_LEN);
    28                }
    29                if(0 == strcmp(Alternate_rule[i].Alternate_rule_list[j].Banxi, (*link_list_behind)[k].banxi))
    30                {
    31                    strcpy((*link_list_behind)[k].behind + count_behind, Alternate_rule[i].Alternate_rule_list[j].Next_Banxi);
    32                    count_behind++;
    33                    (*link_list_behind)[k].behind = (char(*)[BANXI_LEN])realloc((*link_list_behind)[k].behind, (count_behind + 1) * sizeof(char[BANXI_LEN]));
    34                    memset((*link_list_behind)[k].behind + count_behind, 0x0, BANXI_LEN);
    35 
    36                }
    37             }
    38         }
    39         (*link_list_before)[k].Count = count_before;
    40         (*link_list_behind)[k].Count = count_behind;
    41     }         
    42 }
  • 相关阅读:
    小程序40001错误
    【2020-06-07】把心思放在赚钱上就对了
    【2020-06-05】下点功夫,看清题目,并做好选择
    【2020-06-04】人生十三信条
    【2020-06-03】顺境时也需要放空
    【2020-06-02】我感染别人的同时,也加强了自己的信念
    【2020-06-01】信息的吸收源自压力
    【一句日历】2020年6月
    【2020-05-30】向风、向雨、向阳光去讨教
    【2020-05-29】爱眼前的一切
  • 原文地址:https://www.cnblogs.com/hdu-2010/p/3392326.html
Copyright © 2011-2022 走看看