Hi.
I hava a program that contains following codes :
static int ** mat1=NULL;
static int * a=NULL;
mat1=(int **) malloc((sizeof (int *)*n));
for (i=0; i<n;i++)
   mat1[i]=(int *) malloc(sizeof(int)*n);
a=(int *) malloc(sizeof(int)*n);
for (i=0;i<n;i++)
    for (j=0;j<n;j++)
         mat1[i][j]=0;
printf("ok");
/*comment*/
for(i=0;i<n;i++)
     a[i]=0;
printf("ok2");
when I compile this code there is no error. but when run it (debbug) the program is executed until line /*comment*/ and the message "segmentation fault " apear.even if I delete line a[i]=0 from program the code printf("ok2") is'nt execute.
how I can solve this problem?
Regards.


Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software

Reply via email to