This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Program works good but not terminates


Hi,

I have made a program ( main code below , not all,  )
It works good, but not terminates ( I must use Ctrl-Z to stop it )
I do not know the reason of it. 
Thx in advanace 

Adam


-----Console ------------------- 

adam@adam-laptop:~/c/interior/ilsmj/d/v/v1$ gcc a.c -lm -Wall
adam@adam-laptop:~/c/interior/ilsmj/d/v/v1$ ./a.out
memory is OK
File a0.100000000.pgm saved. 
File a0.105000000.pgm saved. 
File a0.110000000.pgm saved. 
File a0.115000000.pgm saved. 
File a0.120000000.pgm saved. 
File a0.125000000.pgm saved. 
File a0.130000000.pgm saved. 
File a0.135000000.pgm saved. 
File a0.140000000.pgm saved. 
File a0.145000000.pgm saved. 
File a0.150000000.pgm saved. 
File a0.155000000.pgm saved. 
File a0.160000000.pgm saved. 
File a0.165000000.pgm saved. 
File a0.170000000.pgm saved. 
File a0.175000000.pgm saved. 
File a0.180000000.pgm saved. 
File a0.185000000.pgm saved. 
File a0.190000000.pgm saved. 
done 

---------- code --------------- 

int main()
{
  double complex Za;  /* atractor ZA = ZAx + ZAy*i */
  /* */
  double aR;   
  double aRmax=0.2;
  double aRmin= 0.1;
  int i,iMax=20;
  double step_aR  = (aRmax-aRmin)/20;

  /* dynamic 1D arrays for colors ( shades of gray ) */
  unsigned char *Data, *Edge;
  Data = malloc( iLength * sizeof(unsigned char) );
  Edge = malloc( iLength * sizeof(unsigned char) );
  if (Data == NULL || Edge==NULL)
    {
      fprintf(stderr,"Could not allocate memory");
      getchar(); 
      return 1;
    }
  else 
    {  printf("memory is OK\n");

      Za = GiveAttractor( Cx, Cy, ER2, IterationMaxBig); 
  
      for(i=0;i<iMax-1;i++){ 
	aR = aRmin+i*step_aR;
	Make_File( aR, Data, Edge, Za);
      }
      /* --------------free memory ---------------------*/
      free(Data);
      free(Edge);
      printf("done \n");
      return 0;
    }
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]