By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,548 Members | 1,155 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,548 IT Pros & Developers. It's quick & easy.

can't find time needed to load 6 file in a linked list?

P: 1
Please enter the representation to use: List, BST, Hash Maps
Please enter a filename:
File loaded successfully. 6 files loaded from the file in 0 seconds and 548 microseconds.

"0 seconds and 548 microseconds"


I am new in c language and in my program what we have to do is to load 6 files of almost 15000+ words total and must calculate the time taken in seconds and microseconds both but there are so many ways to load and show times but none of it work exactly as it shown and i can't think of logic how it going to work so

if someone please provide me idea or help me by suggesting built in function and by showing some code which will work.
Thank You
Nov 8 '16 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 5K+
P: 9,197
Why a linked list? Just use malloc() to allocate enough heap memory to hold your 6 files and read them into that memory.

Then I would put the loading in a loop an run it, say 1000 times.

Then I would get the system time before the loop and again after the loop. Get the difference in times and divide by 1000.

The reason for the loop of 1000 loads is that your computer is so fast there will be no difference between start time and end for a single load. You need enough loading so that the time functions will record a difference. I'm just guessing at 1000 loads. You may need more.

This is a very advanced subject for a beginner. What kind of class are you taking?
Nov 8 '16 #2

Post your reply

Sign in to post your reply or Sign up for a free account.