this code is not working as per its expected output.please tell me the errors and how to rectify them.

```
#include<iostream.h>
#include<stdlib.h>
#include<conio.h>
int* getwaitingtime(int* proc,int* arr,int* bur,int noofproc)
{
int i,j,c[10],t,p,m,s[10],out[10],f,l;
int *wait;
for(i=0;i<noofproc;i++)
{
if((arr[0]!=0)||(arr[i]>arr[i+1])||(arr[i]==arr[i+1])||(bur[i]<0)||(bur[i]==0)||(bur[i]>10))
{
return NULL;
}
}
for(i=0;i<noofproc;i++)
{
c[i]=arr[i]+bur[i];
}
for(i=1;i<noofproc;i++)
{
for(j=1;j<noofproc;j++)
{
if(c[j]>c[j+1])
{
t=c[j];
c[j]=c[j+1];
c[j+1]=t;
p=arr[j];
arr[j]=arr[j+1];
arr[j+1]=p;
m=bur[j];
bur[j]=bur[j+1];
bur[j+1]=m;
}
}
}
s[0]=c[0];
for(i=1;i<noofproc;i++)
{
s[i]=s[i-1]+bur[i];
}
for(i=0;i<noofproc;i++)
{
out[i]=s[i]-(arr[i]+bur[i]);
}
for(i=0;i<noofproc;i++)
{
for(j=0;j<(noofproc-1);j++)
{
if(arr[j]>arr[j+1])
{
f=arr[j];
arr[j]=arr[j+1];
arr[j+1]=f;
l=out[j];
out[j]=out[j+1];
out[j+1]=l;
}
}
}
wait=out;
return wait;
}
void main()
{
clrscr();
int arr[]={0,2,4,5},bur[]={7,4,1,4},proc[]={1,2,3,4},noofproc=4;
int *output[10],i;
output[10]=(*getwaitingtime)(proc,arr,bur,noofproc);
//if(output==NULL)
//{
//cout<<"wrong";
//}
//else
//{
for(i=0;i<noofproc;i++)
{
cout<<*(output[i])<<endl;
}
//}
getch();
}
```