我已经阅读过有关类似问题的问题,但2D或动态数组的问题已经在那里解决了。(有指针,但我想没有它们。)
#include <stdio.h>
#include <stdlib.h>
int interseq ( int, int ); // interval sequence
int main()
{
int arr[100] = { 75, 47, 64, 45, 67, 51, 55, 36, 63, 30,
39, 58, 55, 67, 70, 44, 46, 51, 51, 61,
50, 54, 49, 51, 52, 54, 64, 68, 45, 40,
48, 60, 55, 37, 36, 13, 62, 53, 37, 53,
52, 49, 37, 54, 69, 44, 53, 58, 77, 46,
44, 63, 57, 64, 28, 46, 50, 57, 42, 72,
12, 69, 52, 53, 77, 50, 45, 49, 49, 46,
28, 40, 65, 25, 45, 45, 62, 28, 39, 69,
52, 57, 39, 73, 37, 46, 38, 65, 49, 58,
63, 30, 51, 48, 47, 56, 48, 41, 30, 54 };
printf("%d", interseq ( arr, diagArr) );
return 0;
}
/* User's function. Description: 'farr' is 'arr' and so on.. */
int interseq ( int farr, int fdiagArr)
{
int min, i;
for ( i = 0; i < 100; i++ ) // Finding the 'min' element.
if ( farr[i+1] < farr[i] ) // there are 2 errors
min = farr[i]; // there is 1 error
else
min = farr[i+1]; // there is 1 error
return 1;
}
错误是一样的:
error: subscripted value is neither array nor pointer nor vector