this code gives an error ([Warning] passing arg 1 of `maxdiff' makes integer
from pointer without a cast) . Please explain the reasons.
#include<stdio.h>
#include<conio.h>
int maxdiff(int );
main()
{
int p,arr[]={2,4,1,6,23,4};
p=maxdiff(arr);
printf("\n MAX Diff is \t %d",p);
getch();
}
int maxdiff(int arr[])
{
int diff=0,len,i,j;
unsigned p;
len=sizeof(arr)/sizeof(arr[0]);
for(i=0;i<len;i++)
{
for(j=i;j<len;j++)
{
p=arr[j]-arr[i];
if((p-diff)>0)
diff=p;
}
}
return diff;
}
--
with regards,
Ashwini kumar singh
ECE Final yr.
NIT Allahabad
**
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.