예제 #1
0
int main(int argc, char const *argv[])
{
	const int array[]={13,-3,-25,20,-3,-16,-23,18,20,-7,12,-5,-22,15,-4,7};
	int leftBorder,rightBorder;
	int max = getMaxSubArray(array , sizeof(array)/sizeof(int) , &leftBorder , &rightBorder);
	printf("from %d to %d is the max sub array and the max value is : %d \n",leftBorder , rightBorder , max );
	return 0;
}
예제 #2
0
int main()
{
    int i, *arr, n;
    printf("\nEnter n\n");
    scanf("%d", &n);
    arr = malloc(sizeof(int)*n);
    printf("\nEnter elements\n");
    for (i = 0; i < n; ++i)
        scanf("%d", &arr[i]);
    replaceZeros(arr, n);
    getMaxSubArray(arr, n);
    return 0;
}