I am new to c programming.I need a (10^5)*(10^5) matrix within which I define a circular boundary.The matrix entries inside boundary will be 1 and outside 0.For checking I have started with (1000*1000) and it prints the whole matrix if I don't use the free(ar) statement.And when I am using (11*11) matrix and changing the circular boundary accordingly and checking the free(ar)'s action by printing first row it shows previous entries.I am using windows 64 bit machine,and code::blocks 13.12 IDE.This is my code for (11*11) matrix:
    #include <stdio.h>
    #include <stdlib.h>
    #include<math.h>
    #include<conio.h>
    #include<time.h>
    #define NULL ((void *)0)
    main()
    {
        int i,j,n,k,*ar;
        float p;
        printf("Enter n::::");
        scanf("%d",&n);
        ar=(int*)calloc((n*n),sizeof(int));
        if(ar==NULL)
        {
            printf("Memory allocation error");
            exit(1);
        }
        printf("\nThe matrix is::\n");
        for(i=0;i<n;i++)
        {
            for(j=0;j<n;j++)
            {
                p=((i-5)*(i-5)+(j-5)*(j-5));
                if(p<16)
                {
                    ar[i*n+j]=0;
                    printf("%d",ar[i*n+j]);
                }
                else
                {
                    ar[i*n+j]=1;
                    printf("%d",ar[i*n+j]);
                }
            }
            printf("\n");
        }
        printf("\nPRINTING COMPLETE\n");            
        free(ar-(n*n));
        printf("\nThe first row of the matrix is\n\n");
        for(k=0;k<11;k++)
        {
            printf("%d\t",*(ar+k));
        }
    }
The output is:
      Enter n::::11
      The matrix is::
      11111111111
      11111111111
      11100000111
      11000000011
      11000000011
      11000000011
      11000000011
      11000000011
      11100000111
      11111111111
      11111111111
      PRINTING COMPLETE
      The first row of the matrix is
        1         1       1       1       1       1       1       1                                          
        1         1       1
 
     
    