Thread: Crystal simulation

  1. #1
    Registered User
    Join Date
    Jan 2013
    Posts
    2

    Crystal simulation

    I am working on a project that requires me to build a program that simulates particle aggregation. I have built the program. However when run on a windows machine it crashes for larger array size and number of particles. on linux machine for large numbers it runs for long time and eventually fails.
    randwalk.c
    the program crashes in the for loop beginning line 107 occasionally in the one begining 34. Any hints and tips would be great . Thinks guys

  2. #2
    Registered User
    Join Date
    May 2010
    Posts
    4,632
    Part of your problems may be being caused by the following:
    ||=== c_homework, Debug ===|
    main.c||In function ‘main’:|
    main.c|18|warning: format ‘%lf’ expects argument of type ‘double *’, but argument 3 has type ‘long int *’ [-Wformat]|
    main.c|19|warning: format ‘%lf’ expects argument of type ‘double *’, but argument 3 has type ‘long int *’ [-Wformat]|
    main.c|28|error: implicit declaration of function ‘time’ [-Wimplicit-function-declaration]|
    main.c|112|warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘long int’ [-Wformat]|
    ||=== Build finished: 1 errors, 3 warnings ===|
    Jim

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Code:
      for(i=0 ; i<N ; i++)
        {
          free(X[i]);
        }
    
        free(X);
    
    .....
      
      for( i=0 ; i<N ; i++ )
      {
        for( j=0 ; j<N ; j++ )
        {
          if( X[j][i]==1 )
    It's called "use after free"
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Registered User
    Join Date
    Jan 2013
    Posts
    2
    I have fixed the errors given and it still crashes i'm going through right now working out whats stopping it randwalk.c . I need to go through and tidy up as well it looks a mess ,more comments.

  5. #5
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    Good for you, Max! Code that looks a mess, is hard to study, and hard to debug.

  6. #6
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > I have fixed the errors given and it still crashes
    That's funny, because your latest attachment is identical to the first one.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Expansion Crystal and AGP
    By jrahhali in forum Tech Board
    Replies: 0
    Last Post: 08-17-2011, 08:04 AM
  2. About Crystal Reports
    By Aga^^ in forum C# Programming
    Replies: 0
    Last Post: 07-29-2009, 08:40 AM
  3. Crystal Reports Help
    By Fordy in forum Tech Board
    Replies: 1
    Last Post: 08-01-2005, 08:59 AM
  4. crystal reports in vb.net
    By beely in forum Windows Programming
    Replies: 0
    Last Post: 01-06-2004, 03:37 AM