Like Tree3Likes
  • 1 Post By Salem
  • 1 Post By Adak
  • 1 Post By Salem

Crystal simulation

This is a discussion on Crystal simulation within the C Programming forums, part of the General Programming Boards category; I am working on a project that requires me to build a program that simulates particle aggregation. I have built ...

  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
    2,919
    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
    32,845
    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"
    stahta01 likes this.
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  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.
    Crossfire likes this.

  6. #6
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,845
    > I have fixed the errors given and it still crashes
    That's funny, because your latest attachment is identical to the first one.
    Crossfire likes this.
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

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, 09:04 AM
  2. About Crystal Reports
    By Aga^^ in forum C# Programming
    Replies: 0
    Last Post: 07-29-2009, 09:40 AM
  3. Crystal Reports Help
    By Fordy in forum Tech Board
    Replies: 1
    Last Post: 08-01-2005, 09:59 AM
  4. crystal reports in vb.net
    By beely in forum Windows Programming
    Replies: 0
    Last Post: 01-06-2004, 03:37 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21