I don't see where you are setting "n".  Give a complete program as a
testcase and I'll look into it.

Jon

On Wed, 27 Aug 2003, reza saeidinia wrote:

> 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


-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]
https://www.redhat.com/mailman/listinfo/redhat-list

Reply via email to