Test list.c
De la WikiLabs
Versiunea din 3 aprilie 2014 09:03, autor: Rhobincu (discuție | contribuții) (Pagină nouă: <syntaxhighlight lang="c"> #include "list.h" #include <stdlib.h> #include <stdio.h> #define LIST_SIZE 1000 int main(){ struct simply_linked_list * list = create_simply_lin...)
#include "list.h"
#include <stdlib.h>
#include <stdio.h>
#define LIST_SIZE 1000
int main(){
struct simply_linked_list * list = create_simply_linked_list(LIST_SIZE);
struct simply_linked_node * node;
while(list->size < LIST_SIZE){
node = create_simply_linked_node(rand() % 10);
add_node_to_end_of_list(node, list);
}
int n;
int index = 0;
printf("n = ");
scanf("%d", &n);
for(node = list->first; node != NULL; node = node->next){
if(node->data == n){
printf("%d, ", index);
}
index++;
}
printf("\n");
/*
while(list->size){
delete_node(list, 0);
}
*/
return 0;
}