• 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
  • Liutauras Vilda
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Carey Brown
  • Stephan van Hulst
  • Tim Holloway
  • Peter Rooke
  • Himai Minh
Bartenders:
  • Piet Souris
  • Mikalai Zaikin

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: 77908
373
  • 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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic