1: int sum_of_nodes(int pos1,int pos2)
2: {
3: int sum = 0;
4: int i;
5: list_t *temp = NULL;
6: for(i=1,temp = start;temp;temp = temp->next,i++)
7: {
8: if ( i >= pos1 && i <= pos2)
9: {
10: sum += temp->data;
11: }
12: }
13: return sum;
14: }
RTOS, Linux Kernel internal, OS-Programming C & Data Structures, Debugging, Optimizations, Makefiles and Wireless Technologies (Wi-Fi ,LTE and LTE-Advanced )
Search This Blog
Sunday, September 21, 2014
WAP to add all node value within a given range in SLL
Labels:
C,
Data Structure
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment