???д????????C????
???????????? ???????[ 2016/1/13 10:19:07 ] ??????????????? .NET
???????????
?????嵥 2. ??????
Node *node = NULL;
List *list = NULL;
void insert(void *node);
void drop(void *node);
void clear();
int getSize();
void print();
void* get(int index);
List *ListConstruction(){
list = (List*)malloc(sizeof(List));
node = (Node*)malloc(sizeof(Node));
list->head = node;
list->insert = insert;
// ?? insert ???????????? list ?????
list->drop = drop;
list->clear = clear;
list->size = 0;
list->getSize = getSize;
list->get = get;
list->print = print;
list->_this = list;
// ?? _this ??? list ???????????
return (List*)list;
}
????????????????? _this ???_this ???????????? list ?????????? _this ???????????????????????
?????嵥 3. ???????
// ????? node ??????? list ??????
void insert(void *node){
Node *current = (Node*)malloc(sizeof(Node));
current->data = node;
current->next = list->_this->head->next;
list->_this->head->next = current;
(list->_this->size)++;
}
// ????????????? node
void drop(void *node){
Node *t = list->_this->head;
Node *d = NULL;
int i = 0;
for(i;i < list->_this->size;i++){
d = list->_this->head->next;
if(d->data == ((Node*)node)->data){
list->_this->head->next = d->next;
free(d);
(list->_this->size)--;
break;
}else{
list->_this->head = list->_this->head->next;
}
}
list->_this->head = t;
}
???????????????????ο?????????????????????????????о??????
????????
???????????
??????????????????й??????????????????????????? API ?????????????????????????????????
?????嵥 4. ???????
int main(int argc?? char** argv) {
List *list = (List*)ListConstruction();
// ????????μ?????
// ?????Щ???????
list->insert("Apple");
list->insert("Borland");
list->insert("Cisco");
list->insert("Dell");
list->insert("Electrolux");
list->insert("FireFox");
list->insert("Google");
list->print();
// ????????б?
printf("list size = %d "??list->getSize());
Node node;
node.data = "Electrolux";
node.next = NULL;
list->drop(&node);
// ?????????
node.data = "Cisco";
node.next = NULL;
list->drop(&node);
// ???????????
list->print();
// ??δ??
printf("list size = %d "??list->getSize());
list->clear();
// ????б?
return 0;
}
????? 1. ???н??
??????????
????C ????????????UNIX??????????????????????????м?????????????????????????????Щ?????????????????????????á? ??????C ??????????????C ????????????????????? C ????????????磬?????????????????????????????????????????? C ???????????????? C ?????????????????????????? C ????????Щ?????????????????????????????????????????????????????
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
C?????????????????????C?????????????C?????????????malloc??realloc????C??????????????8?????????C??????const?????ü?????C?????Ч????????????????C?????????C????д???????????????????????C????????λ?????C??????define???????÷??????C???????pthread???????C???????????????C????λ????ü??????????C???????????????????C?????з????????????????????????C?????????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????