I am Bsc(I.T) student. I am learning C programming language. In want to write a program to reverse the order of the letters using linked list? I tried differnt technique but not any of them worked out. Can anybody tell me how to do that.
I am Bsc(I.T) student. I am learning C programming language. In want to write a program to reverse the order of the letters using linked list? I tried differnt technique but not any of them worked out. Can anybody tell me how to do that.
Try to understand following code which is given below.It is very simple code.
In the given code I have use ReverseList( ) function to invalidate the order of the letters using connected list. I also use while loop to do this.Code:Node* ReverseList( Node ** List ) { Node *temp1 = *List; Node * temp2 = NULL; Node * temp3 = NULL; while ( temp1 ) { *List = temp1; temps2= temps1->pNext; temp1->pNext = temp3; temp3 = temp1; temp1 = temp2; } return *List; }
Bookmarks