I need some hint for implementing this algorithm in C. This is a maximum subarray problem. I have made the polynomial time program and also linear time program. I am new to C so I don't know how to return multiple values from a function as this algorithm requires it. For example this line in the algorithm (left-low,left-high,left-sum)=FIND-MAXIMUM-SUBARRAY(A,low,mid) where FIND-MAX-SUBARRAY(A,low,mid) is a recursive function call.
This is the algorithm from coremen:

Below I have set the global variables cross-low,cross-high,cross-sum . How can I do the same for left-low,left-high,left-sum and right-low,right-high,right-sum?
#include "max_subarray_common.h"
#define SENTINAL -3000
int left_low,left_high,left_sum;
int right_low,right_high,right_sum;
int cross_low,cross_high,cross_sum;
void max_crossing_subarray(int low,int mid,int high)
{
int left_sum=SENTINAL;
int sum=0;
int max_left=low,max_right=high;
for(int i=mid;i>=low;i--)
{
sum=sum+change[i];
if(sum>left_sum)
{
left_sum=sum;
max_left=i;
}
}
int right_sum=0;
sum=0;
for(int j=mid+1;j<=high;j++)
{
sum=sum+change[j];
if(sum>right_sum)
{
right_sum=sum;
max_right=j;
}
}
cross_low=max_left;
cross_high=max_right;
cross_sum=left_sum+right_sum;
}
This is my header file:
#ifndef max_subarray_h
#define max_subarray_h
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
extern int price[];
extern int n;
extern int change[];
extern int from;
extern int to;
extern int max;
void init_change();
void max_subarray_poly();
void max_subarray_crossing();
void max_subarray_rec();
void max_crossing_subarray();
#endif
change[] is the array for which the subarray is to be found. Also my output should look like this:
from=8
to=11
maximum profit=43