linked lists source

a program that randomly enters numbers from say 0 to 100 in order to a linked list. the program then calculates the sum o the numbers and the floating point average. Looking for any source code.
Who is Participating?
Mahdi MansourConnect With a Mentor Design Monitoring & Evaluation ManagerCommented:
first define the structur of the link list (single link list)
typedef struct st {
 int no;
 struct st *next; }node_type;
 in the main()
 node_type *ptr=NULL;

then u can jenerate the randomlt numbers by useing the function rand()

then write function travers that
travers on the link and u can add the values of nodes  and find their avg
 the loop :
sur eit's not homework?
Evaluating UTMs? Here's what you need to know!

Evaluating a UTM appliance and vendor can prove to be an overwhelming exercise.  How can you make sure that you're getting the security that your organization needs without breaking the bank? Check out our UTM Buyer's Guide for more information on what you should be looking for!

Sure looks like it is.
1) define a struct to represent a node of the list with a float data member and a pointer to a struct of that type to point to the next node in the list.

2) define a pointer variable in your application that points to the head of your list.

3) call seed() to seed your random number generator and rand() to give you a new random number.

4) define a function insert(float n) that looks through the list starting at the head of the list for the proper value in a node after which you can insert your new number and then creates and links in the new node, "head-to-tail", that is, set the value of the "next" pointer of the node you just created to the value of the next pointer of the node you found (insert point), and make the next pointer of the node you found point to the new node.

5) after all inserts done, traverse the list from head to tail, sum the numbers and divide by the number of entries.
Voila! You're done...
What we can give here are ways to achieve your answer :). We can help you debug your problem but not write programs for you :)
All Courses

From novice to tech pro — start learning today.