0
votes

I get the following error on Code execution. What am i missing?
warning: passing argument 1 of ‘Max’ makes pointer from integer without a cast [-Wint-conversion] warning: return makes integer from pointer without a cast [-Wint-conversion].

//Header files declaration

#include<stdio.h>
#include<conio.h>
#include<stdlib.h>

//Function Declarations

int Max(int Ar[15],int x);
int Array(int Ar[15],int a);


int main()
{
    int Ary[15],x1,Max1;

  printf("\n \n Enter the Size of Array: ");
  scanf("%d",&x1);

  printf(" Input elements of Array:");  


   //Function Call

   //Array Builder
   Array(Ary[15], x1);

   //Compute Maximum Number of Array
  Max1=Max(Ary[15],x1);

   //Displaying Maximum Number of Array

   printf("\n Maximum Number of Array:");
   printf("%d",Max1);         

   return 0;
 }

//Function-Build Array    

int Array(int Ar[15],int a)
{
 int i,j;
 for(i=0;i<a;i++)
 {
  scanf("%d",&Ar[i]);
 }
 return Ar;
}

//Function-Compute Maximum element of Array

int Max(int Ar[15],int x)
{
    int i,j,v,Max_n;
    Ar[0]=Max_n;

    for(i=1;i<x;i++)
 {
   if(Ar[i]>Max_n)    
   {
      v=Max_n;
      Max_n=Ar[i];
      Ar[i]=v;

   }
 }
 return Max_n;    
}
1

1 Answers

0
votes

Ary[15] gives you the last int of your array, you should try to pass the array itself instead : Array(Ary,x1) and Max(Ary,x1).

By the way, it was only a warning. A big one though, your program is bound to crash at some point.