单链表的节点乘积
#include #include //structure of a node struct node{ int data; struct node *next; }*head,*temp; //function for inserting nodes into a list void insert(int val){ struct node* newnode = (struct node*)malloc(sizeof(struct node)); newnode->data = val; newnode->next = NULL; if(head == NULL){ head = newnode; temp = head; } else { temp->next=newnode; temp=temp->next; } } //function for displaying a list void display(){ if(head==NULL) printf("no node "); else{ temp=head; while(temp!=NULL){ printf("%d ",temp->data); temp=temp->next; } } } //function for finding product void product_nodes(){ int product=1; temp=head; while(temp!=NULL){ product=product * (temp->data); temp=temp->next; } printf("