Home > Back-end >  C language input format saddle point problem
C language input format saddle point problem

Time:09-21


Topic is require input format
Can use the scanf once read in a row?
For example,
Int a [], [4]={0};

The scanf (" % d ", & amp; Columnum);

For (int I=0; I & lt; Columnum; I++)
{
The scanf (" % d % d % d % d ", & amp; A [I] [0], & amp; [1], a [I] & amp; A [I] [2], & amp; A, [I] [3]).
}
Compilation can pass but after input have been hints that
Warning C6385 read data from the "a" is invalid: readable size to 16 bytes, but may read the "64" bytes,
Could you tell me where is the problem?
Is written to use only two cycle array values?

CodePudding user response:

Defined as a [4] [4] will be good

CodePudding user response:

Int a [], [4]={0}; To int a [4] [4]={0};
In addition, you here n=4 is just a example, according to the topic request, n - 100, so it's best to define the array as a [100] [100]
For example
 int main () 
{
Int n, I, j, the row, col, a [100] [100].
The scanf (" % d ", & amp; N);//input lines
for (i=0; ifor (j=0; JThe scanf (" % d ", & amp; A [I] [j]);
}
}
for (i=0; iFor (col=0, j=1; JIf (a [I] [col] Col=j;
}
For (row=0, j=1; JIf (a [row] [col] & gt; A [j] [col])
The row=j;
}
If (row==I)//if the minimum number of line is just the current line, the output
Printf (" % d % d \ n ", the row, col);
}
return 0;
}

  • Related