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 }
  • 相关阅读:
    使用Node.js创建第一个应用
    Node.js安装
    Node.js简介
    c#中的索引器
    ASP.NET常用内置对象(三)Server
    ASP.NET常用内置对象(二)Response
    ASP.NET常用内置对象(一)Request
    利用JDBC工具类 模拟用户登录!
    JDBC工具类完整版!
    用户登录
  • 原文地址:https://www.cnblogs.com/hdu-2010/p/3392326.html
Copyright © 2011-2022 走看看