Hi,
I created a C program which basically calculates bunch of variable values.... Although the desired output for the final version program is just a few lines, however, for debugging purpose, I've printed the variable values everytime a change is being made in-code. As a result, the output consist of hundred of lines....

Now, even though the program compiles fine and the final output is correct and as desired, however, the entire thing(variable values after changes + final output) is not being printed. What I mean is that, I see the final output and only a few lines of the variable change values before the final output but not the entire list...

I want to see the output of the entire printf command, right from the beginning till the end of the program. How do I do it?

By the way, I'm using dev c++...

Regards,

It's basically a word finder program :

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<time.h>

void step1(char** , int, int, char [], int*, int*, int*);
void step2(char**, int, int, char [], int, int, int*);
void step3(char**, char [], int , int, int  );

FILE *data;

int main()
{ 
  data=fopen("word.txt","r");

  int row,col,count=0,sno=0;
  char s[20]; //={"BOAT"};
  char list[100][20];

  //fscanf(data,"%s",&s);

  srand ( time(NULL) );

  printf("INPUT THE NUMBER OF ROWS IN THE GRID : ");
  scanf("%d",&row);

  printf("\nINPUT THE NUMBER OF COLUMNS IN THE GRID : ");
  scanf("%d",&col);

  /*==================================================*/

  char** grid;  
    grid = (char**) malloc(row*sizeof(char*));  
    for (int i = 0; i < row; i++)  
       grid[i] = (char*) malloc(col*sizeof(char*));  

  /*==================================================*/

  //char grid[row][10];

  for(int i=0;i<row;++i)
    for(int j=0;j<col;++j)
      grid[i][j]='0';

  /*for(int i=0;i<row;++i)
   { for(int j=0;j<col;++j)
       printf(" %c ", grid[i][j]);
     printf("\n\n"); }*/

  int m,n,x1;
  int dir[8];
  int dir2[8];

  while((fscanf(data,"%s",&s))==1)
  {

  printf("\n /* ====================================================================== */");
  printf("\n word : %s ",&s);

  int pass1=0;
  int pass2=0;

  step1(grid, row, col, s, &m, &n, &pass1);

  printf("\nm=%d = ",m);
  printf("\nn=%d = ",n);

  step2(grid, row, col, s, m, n, dir); // FOR CHECKING POSSIBLE DIRECTIONS

  /* ====================================================================== */

  for(int i=0;i<8;++i)
     dir2[i]=0;

  for(int i=0; i<8; ++i)
     if(dir[i]==1)
        {dir2[i]=dir[i];
         pass2=1;}

   printf("\npass1=%d = ",pass1);
  printf("\npass2=%d = \n\n",pass2);

   if(pass1==1&&pass2==1)     
     do {x1 = rand()%8;} while(dir2[x1]!=1);
     printf("\n DIR : %d \n",x1);   

  /* ====================================================================== */

  if(pass1==1&&pass2==1)     
  step3(grid, s, m,n, x1 );

  if(pass1==1&&pass2==1)
    {strcpy(list[sno],s);
     ++sno;}



}

  strcpy(list[sno],"$");

  int rn = rand() % 26;
  char rnda= (char)(rn+65);

  for(int i=0;i<row;++i)
    for(int j=0;j<col;++j)
      if(grid[i][j]=='0')
         { rn = rand() % 26;
           rnda = (char)(rn+65);
           grid[i][j]='#'; }

  printf("  ");
  for(int j=0;j<col;++j)
  if(j>10)
  printf("%d ",j);
  else
  printf(" %d ",j);

  printf("\n");

  for(int i=0;i<row;++i)
   { if(i>=10)
     printf("%d",i);
     else
     printf(" %d",i);

     for(int j=0;j<col;++j)
       printf(" %c ", grid[i][j]);
     printf("\n\n"); }

  printf("\n\n");   

  for(int i=0;i<row;++i)
    for(int j=0;j<col;++j)
      if(grid[i][j]=='#')
         { rn = rand() % 26;
           rnda = (char)(rn+65);
           grid[i][j]=rnda; }

  for(int i=0;i<row;++i)
   { for(int j=0;j<col;++j)
       printf(" %c ", grid[i][j]);
     printf("\n\n"); }

  int k=0;

  while(list[k][0]!='$')
    {printf("\n %s ",list[k]);
     ++k;}

  for(int i = 0; i < row; i++)
        free(grid[i]);
    free(grid);   

  system("pause");
  return 0; 

}


void step1(char **grid, int row, int col, char s[],int *p,int *q, int *pass)
  { 
    int r1[row];
    int c1[col];
    int x,y;
    int i,j;

    for(i=0;i<row;++i)
      r1[i]='1';

    for(i=0;i<col;++i)
      c1[i]='1';

    for(i=0;i<row;++i)
      for(j=0;j<col;++j)
        { if(grid[i][j]=='0'||grid[i][j]==s[0])  
            { *pass=1;
              r1[i]='0';
              c1[j]='0'; }
        }

    if(*pass==1)  
      { do {x = rand()%(row);} while (r1[x]!='0');
        do {y = rand()%(col);} while (c1[y]!='0');

        *p = x;
        *q = y; }

  }  


void step2(char **grid, int row, int col, char s[], int p, int q, int d[])
  {  
     int tr;
     tr=0;
     int tc;
     tc=0;
     int i,count;


    // FOR NORTH
     count=0;
     tr = p;
     tc = q;


     while(tr>=0 && count<strlen(s) && (grid[tr][tc]=='0'||grid[tr][tc]==s[count]))
       { ++count;
         --tr;
       }

     printf("\n 0.N.2count = %d", count);

     if (count==strlen(s))
       d[0]=1;
         else
       d[0]=0;

     //FOR NORTH EAST
     count=0;
     tr = p;
     tc = q;


     while( tr>=0 && tc<col && count<strlen(s) && (grid[tr][tc]=='0'||grid[tr][tc]==s[count]))
       { ++count;
         --tr;
         ++tc;
       }

     printf("\n 1.NE.2count = %d", count);

     if (count==strlen(s))
       d[1]=1;
         else
       d[1]=0;

     //FOR EAST
     count=0;
     tr = p;
     tc = q;

     while(tc<col && count<strlen(s) && (grid[tr][tc]=='0'||grid[tr][tc]==s[count]))
       { ++count;
         ++tc;
       }

       printf("\n 2.E.2count = %d", count);

     if (count==strlen(s))
       d[2]=1;
         else
       d[2]=0;

     //FOR SOUTH EAST
     count=0;
     tr = p;
     tc = q;
     while( tr<row && tc<col && count<strlen(s) && (grid[tr][tc]=='0'||grid[tr][tc]==s[count]))
       { ++count;
         ++tc;
         ++tr;
       }

       printf("\n 3.SE.2count = %d", count);

     if (count==strlen(s))
       d[3]=1;
         else
       d[3]=0;  

     //FOR SOUTH
     count=0;
     tr = p;
     tc = q;
     while( tr<row && count<strlen(s) && (grid[tr][tc]=='0'||grid[tr][tc]==s[count]))
       { ++count;
         ++tr;
       }

       printf("\n 4.S.2count = %d", count);

     if (count==strlen(s))
       d[4]=1;
         else
       d[4]=0; 

    //FOR SOUTH WEST
     count=0;
     tr = p;
     tc = q;
     while( tr<row && tc>=0 && count<strlen(s) && (grid[tr][tc]=='0'||grid[tr][tc]==s[count]))
       { ++count;
         ++tr;
         --tc;
       }

       printf("\n 5.SW.2count = %d", count);

     if (count==strlen(s))
       d[5]=1;
         else
       d[5]=0; 

     //FOR WEST
     count=0;
     tr = p;
     tc = q;
     while( tc>=0 && count<strlen(s) && (grid[tr][tc]=='0'||grid[tr][tc]==s[count]))
       { ++count;
          --tc;
       }

       printf("\n 6.W.2count = %d", count);

     if (count==strlen(s))
       d[6]=1;
         else
       d[6]=0; 

     //FOR NORTH WEST
     count=0;
     tr = p;
     tc = q;
     while( tc>=0 && tr>=0 && count<strlen(s) && (grid[tr][tc]=='0'||grid[tr][tc]==s[count]))
       { ++count;
          --tc;
          --tr;
       }

       printf("\n 7.NW.2count = %d", count);

     if (count==strlen(s))
       d[7]=1;
         else
       d[7]=0;



  }

void step3(char **grid, char s[], int m, int n, int x)
  { 
    int tr = m;
    int tc = n;
    int i=0;

    switch (x) {

    case 0 :  //NORTH
       while (i<strlen(s))
         { grid[tr][tc]=s[i];
           ++i;
           --tr; }
       break;

    case 1 : //NORTH EAST
        while (i<strlen(s))
         { grid[tr][tc]=s[i];
           ++i;
           --tr;
           ++tc; }
       break;   

    case 2 : //EAST
        while (i<strlen(s))
         { grid[tr][tc]=s[i];
           ++i;
           ++tc; }
       break; 

    case 3 : //SOUTH EAST
        while (i<strlen(s))
         { grid[tr][tc]=s[i];
           ++i;
           ++tc;
           ++tr; }
       break;  

     case 4 : //SOUTH
        while (i<strlen(s))
         { grid[tr][tc]=s[i];
           ++i;
           ++tr; }
       break;  

      case 5 : //SOUTH WEST
        while (i<strlen(s))
         { grid[tr][tc]=s[i];
           ++i;
           ++tr;
           --tc; }
       break;  

      case 6 : //WEST
        while (i<strlen(s))
         { grid[tr][tc]=s[i];
           ++i;
           --tc; }
       break; 

      case 7 : //NORTH WEST
        while (i<strlen(s))
         { grid[tr][tc]=s[i];
           ++i;
           --tc;
           --tr; }
       break; 


       }

  }

The text file word.txt conents are:

TEMPERATURE
TEACHER
COMPUTER 
ALLOCATE 
LOVE 
TREE 
KEYBOARD
TUTOR
FOLDER
PENCIL
NOTEPAD
DISK
MOUSE
WIRE

Hello,

In the beigin of your program: line 54 and line 58:

Are you sure that you have to use "&" to store data in a char array with fscanf?

And to print the content of the "s" variable with printf, you don't need to use &s, you juste have to give "s" in the parameters.

while((fscanf(data,"%s",s))==1)
{
    printf("\n /* ====================================================================== */");
    printf("\n word : %s ",s);

I hope it can help you.

Hi,

Actually that printf statment was a mistake. Corrected it.... Regarding the fscanf statment, I removed the "&" and tried. No difference..

However, no change in the manner of the output. I'm still not getting the stuffs right from the beginning.. Only the last few stuffs...

And I'd again like to remind, the final output is correct and as expected however I wanted those printf stuffs right from the beginning for the sake of debugging and improving my current program...

Can anyone please compile the above code and let me know it everything is being ouputted or not. If you are willing to compile, don't forget to add the "word.txt" file in the directory of source else the program will not work..

Regards..

What kind of output are you expecting? Mine did this:

C:\tcc>tcc -run outputtest.c
INPUT THE NUMBER OF ROWS IN THE GRID : 5

INPUT THE NUMBER OF COLUMNS IN THE GRID : 5

 /* ====================================================================== */
 word : TEMPERATURE
m=4 =
n=4 =
 0.N.2count = 5
 1.NE.2count = 1
 2.E.2count = 1
 3.SE.2count = 1
 4.S.2count = 1
 5.SW.2count = 1
 6.W.2count = 5
 7.NW.2count = 5
pass1=1 =
pass2=0 =


 DIR : 6441216

 /* ====================================================================== */
 word : TEACHER
m=3 =
n=0 =
 0.N.2count = 4
 1.NE.2count = 4
 2.E.2count = 5
 3.SE.2count = 2
 4.S.2count = 2
 5.SW.2count = 1
 6.W.2count = 1
 7.NW.2count = 1
pass1=1 =
pass2=0 =


 DIR : 6441216

 /* ====================================================================== */
 word : COMPUTER
m=1 =
n=3 =
 0.N.2count = 2
 1.NE.2count = 2
 2.E.2count = 2
 3.SE.2count = 2
 4.S.2count = 4
 5.SW.2count = 4
 6.W.2count = 4
 7.NW.2count = 2
pass1=1 =
pass2=0 =


 DIR : 6441216

 /* ====================================================================== */
 word : ALLOCATE
m=1 =
n=4 =
 0.N.2count = 2
 1.NE.2count = 1
 2.E.2count = 1
 3.SE.2count = 1
 4.S.2count = 4
 5.SW.2count = 4
 6.W.2count = 5
 7.NW.2count = 2
pass1=1 =
pass2=0 =


 DIR : 6441216

 /* ====================================================================== */
 word : LOVE
m=2 =
n=4 =
 0.N.2count = 3
 1.NE.2count = 1
 2.E.2count = 1
 3.SE.2count = 1
 4.S.2count = 3
 5.SW.2count = 3
 6.W.2count = 4
 7.NW.2count = 3
pass1=1 =
pass2=1 =


 DIR : 6

 /* ====================================================================== */
 word : TREE
m=1 =
n=0 =
 0.N.2count = 2
 1.NE.2count = 2
 2.E.2count = 4
 3.SE.2count = 1
 4.S.2count = 4
 5.SW.2count = 1
 6.W.2count = 1
 7.NW.2count = 1
pass1=1 =
pass2=1 =


 DIR : 2

 /* ====================================================================== */
 word : KEYBOARD
m=2 =
n=1 =
 0.N.2count = 0
 1.NE.2count = 0
 2.E.2count = 0
 3.SE.2count = 0
 4.S.2count = 0
 5.SW.2count = 0
 6.W.2count = 0
 7.NW.2count = 0
pass1=1 =
pass2=0 =


 DIR : 2

 /* ====================================================================== */
 word : TUTOR
m=0 =
n=1 =
 0.N.2count = 1
 1.NE.2count = 1
 2.E.2count = 4
 3.SE.2count = 1
 4.S.2count = 1
 5.SW.2count = 1
 6.W.2count = 2
 7.NW.2count = 1
pass1=1 =
pass2=0 =


 DIR : 2

 /* ====================================================================== */
 word : FOLDER
m=1 =
n=2 =
 0.N.2count = 0
 1.NE.2count = 0
 2.E.2count = 0
 3.SE.2count = 0
 4.S.2count = 0
 5.SW.2count = 0
 6.W.2count = 0
 7.NW.2count = 0
pass1=1 =
pass2=0 =


 DIR : 2

 /* ====================================================================== */
 word : PENCIL
m=1 =
n=2 =
 0.N.2count = 0
 1.NE.2count = 0
 2.E.2count = 0
 3.SE.2count = 0
 4.S.2count = 0
 5.SW.2count = 0
 6.W.2count = 0
 7.NW.2count = 0
pass1=1 =
pass2=0 =


 DIR : 2

 /* ====================================================================== */
 word : NOTEPAD
m=4 =
n=1 =
 0.N.2count = 2
 1.NE.2count = 2
 2.E.2count = 4
 3.SE.2count = 1
 4.S.2count = 1
 5.SW.2count = 1
 6.W.2count = 2
 7.NW.2count = 2
pass1=1 =
pass2=0 =


 DIR : 2

 /* ====================================================================== */
 word : DISK
m=3 =
n=4 =
 0.N.2count = 1
 1.NE.2count = 1
 2.E.2count = 1
 3.SE.2count = 1
 4.S.2count = 2
 5.SW.2count = 2
 6.W.2count = 4
 7.NW.2count = 1
pass1=1 =
pass2=1 =


 DIR : 6

 /* ====================================================================== */
 word : MOUSE
m=2 =
n=2 =
 0.N.2count = 0
 1.NE.2count = 0
 2.E.2count = 0
 3.SE.2count = 0
 4.S.2count = 0
 5.SW.2count = 0
 6.W.2count = 0
 7.NW.2count = 0
pass1=1 =
pass2=0 =


 DIR : 6

 /* ====================================================================== */
 word : WIRE
m=2 =
n=2 =
 0.N.2count = 0
 1.NE.2count = 0
 2.E.2count = 0
 3.SE.2count = 0
 4.S.2count = 0
 5.SW.2count = 0
 6.W.2count = 0
 7.NW.2count = 0
pass1=1 =
pass2=0 =


 DIR : 6
   0  1  2  3  4
 0 #  #  #  #  #

 1 T  R  E  E  #

 2 #  E  V  O  L

 3 #  K  S  I  D

 4 #  #  #  #  #



 K  S  V  V  F

 T  R  E  E  A

 Z  E  V  O  L

 X  K  S  I  D

 K  L  Y  C  Y


 LOVE
 TREE
 DISK Press any key to continue . . .

Actually even I'm getting the full output if I input 5 and 5 for the first two scanf...

However, try inputting a big number like 15 and 15 , then see it you get the entire thing...

Here, 15x15. Is this right?

C:\tcc>tcc -run outputtest.c
INPUT THE NUMBER OF ROWS IN THE GRID : 15

INPUT THE NUMBER OF COLUMNS IN THE GRID : 15

 /* ====================================================================== */
 word : TEMPERATURE
m=4 =
n=1 =
 0.N.2count = 5
 1.NE.2count = 5
 2.E.2count = 11
 3.SE.2count = 11
 4.S.2count = 11
 5.SW.2count = 2
 6.W.2count = 2
 7.NW.2count = 2
pass1=1 =
pass2=1 =


 DIR : 2

 /* ====================================================================== */
 word : TEACHER
m=2 =
n=3 =
 0.N.2count = 3
 1.NE.2count = 3
 2.E.2count = 7
 3.SE.2count = 2
 4.S.2count = 2
 5.SW.2count = 2
 6.W.2count = 4
 7.NW.2count = 3
pass1=1 =
pass2=1 =


 DIR : 2

 /* ====================================================================== */
 word : COMPUTER
m=7 =
n=9 =
 0.N.2count = 3
 1.NE.2count = 6
 2.E.2count = 6
 3.SE.2count = 6
 4.S.2count = 8
 5.SW.2count = 8
 6.W.2count = 8
 7.NW.2count = 3
pass1=1 =
pass2=1 =


 DIR : 5

 /* ====================================================================== */
 word : ALLOCATE
m=8 =
n=10 =
 0.N.2count = 4
 1.NE.2count = 5
 2.E.2count = 5
 3.SE.2count = 5
 4.S.2count = 7
 5.SW.2count = 7
 6.W.2count = 2
 7.NW.2count = 1
pass1=1 =
pass2=0 =


 DIR : 5

 /* ====================================================================== */
 word : LOVE
m=3 =
n=13 =
 0.N.2count = 4
 1.NE.2count = 2
 2.E.2count = 2
 3.SE.2count = 2
 4.S.2count = 4
 5.SW.2count = 4
 6.W.2count = 4
 7.NW.2count = 4
pass1=1 =
pass2=1 =


 DIR : 4

 /* ====================================================================== */
 word : TREE
m=9 =
n=7 =
 0.N.2count = 0
 1.NE.2count = 0
 2.E.2count = 0
 3.SE.2count = 0
 4.S.2count = 0
 5.SW.2count = 0
 6.W.2count = 0
 7.NW.2count = 0
pass1=1 =
pass2=0 =


 DIR : 4

 /* ====================================================================== */
 word : KEYBOARD
m=13 =
n=11 =
 0.N.2count = 8
 1.NE.2count = 4
 2.E.2count = 4
 3.SE.2count = 2
 4.S.2count = 2
 5.SW.2count = 2
 6.W.2count = 8
 7.NW.2count = 4
pass1=1 =
pass2=1 =


 DIR : 6

 /* ====================================================================== */
 word : TUTOR
m=10 =
n=7 =
 0.N.2count = 1
 1.NE.2count = 5
 2.E.2count = 5
 3.SE.2count = 3
 4.S.2count = 5
 5.SW.2count = 3
 6.W.2count = 1
 7.NW.2count = 5
pass1=1 =
pass2=1 =


 DIR : 2

 /* ====================================================================== */
 word : FOLDER
m=5 =
n=0 =
 0.N.2count = 6
 1.NE.2count = 1
 2.E.2count = 6
 3.SE.2count = 6
 4.S.2count = 6
 5.SW.2count = 1
 6.W.2count = 1
 7.NW.2count = 1
pass1=1 =
pass2=1 =


 DIR : 3

 /* ====================================================================== */
 word : PENCIL
m=7 =
n=4 =
 0.N.2count = 3
 1.NE.2count = 3
 2.E.2count = 5
 3.SE.2count = 3
 4.S.2count = 2
 5.SW.2count = 1
 6.W.2count = 2
 7.NW.2count = 3
pass1=1 =
pass2=0 =


 DIR : 3

 /* ====================================================================== */
 word : NOTEPAD
m=6 =
n=5 =
 0.N.2count = 2
 1.NE.2count = 2
 2.E.2count = 7
 3.SE.2count = 4
 4.S.2count = 4
 5.SW.2count = 2
 6.W.2count = 4
 7.NW.2count = 2
pass1=1 =
pass2=1 =


 DIR : 2

 /* ====================================================================== */
 word : DISK
m=9 =
n=10 =
 0.N.2count = 3
 1.NE.2count = 3
 2.E.2count = 4
 3.SE.2count = 1
 4.S.2count = 1
 5.SW.2count = 1
 6.W.2count = 3
 7.NW.2count = 3
pass1=1 =
pass2=1 =


 DIR : 2

 /* ====================================================================== */
 word : MOUSE
m=11 =
n=13 =
 0.N.2count = 2
 1.NE.2count = 2
 2.E.2count = 2
 3.SE.2count = 2
 4.S.2count = 4
 5.SW.2count = 2
 6.W.2count = 5
 7.NW.2count = 2
pass1=1 =
pass2=1 =


 DIR : 6

 /* ====================================================================== */
 word : WIRE
m=2 =
n=5 =
 0.N.2count = 0
 1.NE.2count = 0
 2.E.2count = 0
 3.SE.2count = 0
 4.S.2count = 0
 5.SW.2count = 0
 6.W.2count = 0
 7.NW.2count = 0
pass1=1 =
pass2=0 =


 DIR : 6
   0  1  2  3  4  5  6  7  8  9  10 11 12 13 14
 0 #  #  #  #  #  #  #  #  #  #  #  #  #  #  #

 1 #  #  #  #  #  #  #  #  #  #  #  #  #  #  #

 2 #  #  #  T  E  A  C  H  E  R  #  #  #  #  #

 3 #  #  #  #  #  #  #  #  #  #  #  #  #  L  #

 4 #  T  E  M  P  E  R  A  T  U  R  E  #  O  #

 5 F  #  #  #  #  #  #  #  #  #  #  #  #  V  #

 6 #  O  #  #  #  N  O  T  E  P  A  D  #  E  #

 7 #  #  L  #  #  #  #  #  #  C  #  #  #  #  #

 8 #  #  #  D  #  #  #  #  O  #  #  #  #  #  #

 9 #  #  #  #  E  #  #  M  #  #  D  I  S  K  #

10 #  #  #  #  #  R  P  T  U  T  O  R  #  #  #

11 #  #  #  #  #  U  #  #  #  E  S  U  O  M  #

12 #  #  #  #  T  #  #  #  #  #  #  #  #  #  #

13 #  #  #  E  D  R  A  O  B  Y  E  K  #  #  #

14 #  #  R  #  #  #  #  #  #  #  #  #  #  #  #



 U  G  E  X  Z  C  C  A  G  O  V  B  Y  V  L

 G  Y  R  O  Z  R  G  W  P  N  E  G  V  Q  I

 P  O  O  T  E  A  C  H  E  R  N  L  T  Q  V

 G  Q  Z  R  W  C  I  N  O  D  V  U  I  L  N

 T  T  E  M  P  E  R  A  T  U  R  E  Y  O  X

 F  H  V  L  B  Y  M  H  U  Q  Z  A  Z  V  M

 B  O  L  S  W  N  O  T  E  P  A  D  U  E  X

 M  J  L  F  X  Q  H  E  H  C  K  Y  A  W  Z

 R  D  T  D  Q  P  T  V  O  S  D  I  O  I  X

 M  L  R  N  E  Z  W  M  U  Q  D  I  S  K  I

 X  T  T  T  X  R  P  T  U  T  O  R  F  V  B

 P  V  Z  L  P  U  D  L  Q  E  S  U  O  M  Q

 A  H  X  H  T  N  W  O  V  Z  Q  G  T  H  S

 R  J  A  E  D  R  A  O  B  Y  E  K  Q  D  M

 E  X  R  W  U  O  S  F  H  Q  B  L  E  K  P


 TEMPERATURE
 TEACHER
 COMPUTER
 LOVE
 KEYBOARD
 TUTOR
 FOLDER
 NOTEPAD
 DISK
 MOUSE Press any key to continue . . .

Wow... you are actually getting the entire thing... what compiler and IDE are you using?

Tcc for compiling, notepad++ for writing, and command line execution.

Anyway, at lines 163 and 164 of your code, you didn't get any errors when compiling? I did, and ultimately I had to change them because arrays can't be initialized with a variable size.

int* r1 = (int*) malloc(row*sizeof(int));
int* c1 = (int*) malloc(col*sizeof(int));

Edited 4 Years Ago by scudzilla

I'm using a GCC based compiler (Mingw) and my IDE is Dev-c++.

Regarding those two lines, no I'm not getting any error. My compilers support arrays with variable size. After doing some research I found that certain compilers like Borland etc. dosen't support this feature.

Ok. I downloaded Bloodshed Dev-C++ 5 to try and compile your code (lots of syntax error before / token, and for loop initial declaration used outside C99 mode >.<) and I still get all the expected output..

OH, you wrote this in a cpp file instead of a c file?

Er.. even after running it as c or cpp file, I still get all output.

Last edit:... Maybe your command prompt is limited to 300 lines, which is why you see only the last 300 lines of output? =/

Edited 4 Years Ago by scudzilla

Comments
Your hint to check the command prompt properties worked!!

Command prompt limted to 300 lines? I don't know if this is causing the problem... how can I check and change how many lines my command prompt can output?

EDIT : Ok guess what? I went to the command line properties -> Layout and increased the screen buffer size.... And everything is being printed now..... phew!!!

Anyways, thanks a LOT everybody especially scudzilla for their continous assistance.

Regards..

This question has already been answered. Start a new discussion instead.