+ * Created on: 2011. 4. 21.
+ * from http://milvus.tistory.com/17
+void insert(list* lptr,int value,int position);
+void delete(list* lptr,int position);
+int search(list* lptr,int value);
+void modify(list* lptr,int value,int position);
+void print_list(list* lptr);
+void insert(list* lptr,int value,int position){
+ //insert value to proper position
+ if(position<1 || position>(lptr->count)+1){
+ printf("Position Out of Bound\n");
+ nptr new_nptr=(node*)malloc(sizeof(node));
+ new_nptr->next=lptr->head;
+ for(i=1;i<position-1;i++){
+ new_nptr->next=tmp->next;
+void delete(list* lptr,int position){
+ //delete an item on the position
+ if(position<1 || position>(lptr->count)){
+ printf("Position Out of Bound\n");
+ for(i=1;i<position-1;i++){
+int search(list* lptr,int value){
+ //traverse the list and
+ //find the first position of the value (first from head)
+ //if not exist, return 0
+ if(value==tmp->value) break;
+ printf("The value %d is NOT exists\n",value);
+ printf("The value %d is at position %d in the list\n",value,i);
+void modify(list* lptr,int value,int position){
+ if(position<1 || position>(lptr->count)){
+ printf("Position Out of Bound\n");
+ for(i=1;i<position;i++){
+void print_list(list* lptr){
+ printf("List value: ");
+ printf("%d ",tmp->value);
+ printf("Total: %d value(s)\n",lptr->count);