I want to print the results of the best schedule array (which is shorted in a specific way in the find_best_scedu le function) through the main program. Actually I should print the results by using a second function named print_best_sche dule, but this seems too complicated and I prefer to do one step at a time.
The problem is that I don't know how to print the array through the pointer "ptr".
Here is the code I wrote:
[code=c]
void find_best_sched ule(int TASK_TIMES[6][3],int *ptr[7]);
int print_best_sche dule(int best_schedule[]);
...
int TASK_TIMES[][3] = { {1,15,3}, {2,7,9}, {3,4,10}, {4,7,6}, {5,10,9}, {6,4,5}, {7,7,8}};
int ptrs, k;
find_best_sched ule(TASK_TIMES, &ptrs);
for(k=0; k<7; k++)
printf("%d",ptr s[k]);//Here is the problem
...
void find_best_sched ule(int TASK_TIMES[6][3],int*ptr[7])
{
int i, k, p, n, min, cell, in_schedule[7], best_schedule[7];
<snipped:- code populating best scheduled array>
ptr[7]=&best_schedu le[0];
}[/code]
The problem is that I don't know how to print the array through the pointer "ptr".
Here is the code I wrote:
[code=c]
void find_best_sched ule(int TASK_TIMES[6][3],int *ptr[7]);
int print_best_sche dule(int best_schedule[]);
...
int TASK_TIMES[][3] = { {1,15,3}, {2,7,9}, {3,4,10}, {4,7,6}, {5,10,9}, {6,4,5}, {7,7,8}};
int ptrs, k;
find_best_sched ule(TASK_TIMES, &ptrs);
for(k=0; k<7; k++)
printf("%d",ptr s[k]);//Here is the problem
...
void find_best_sched ule(int TASK_TIMES[6][3],int*ptr[7])
{
int i, k, p, n, min, cell, in_schedule[7], best_schedule[7];
<snipped:- code populating best scheduled array>
ptr[7]=&best_schedu le[0];
}[/code]
Comment