• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Help needed: C Code freezes mid execution

 
Greenhorn
Posts: 25
Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I'm working on a network queue simulator. Although, I'm not really well versed or experienced in programming in C, I was able to get together the following code:





The problem I keep on getting is that sometimes the code works just fine (VERY RARELY) while other times, it works fine for few iterations of the on timer (ton) but stops short of completing. This is actually an assignment for a networking lab.

ANY kind of help is appreciated. Just any. Even if you point me in right direction, that'll be heaps good. Thanks!
 
Marshal
Posts: 73970
332
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As usual, you cannot expect people to read or understand unindented code. Please go back and indent the code correctly with spaces not tabs.
I tried running your code, but something went wrong with my use of log; it said it couldn’t find the function, even though I made sure to write #include <math.h>.
Try putting some debugging code in: lots of print statements.
Also divide that main() function; it looks too long to me.
 
Now I am super curious what sports would be like if we allowed drugs and tiny ads.
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic