I'm trying to create a function that takes 4 integers and returns the greatest int of them. However when I excute the code it takes "5" integers and returns the largest of the first 4. Idk why there is a fifth input, also there is a warning " Unintialized local vriable "d"
`
#include <stdio.h>
int max(int ,int , int , int );
int main() {
int ans,a,b,c,f;
ans=max(a,b,c,f);
printf("%d",ans);
return 0;
}
int max(int x,int y, int z, int k){
int greatest=0;
scanf("%d\n",&x);
scanf("%d\n",&y);
scanf("%d\n",&z);
scanf("%d\n",&k);
if(greatest<x){
greatest=x;
}
if(greatest<y){
greatest=y;
} if(greatest<z){
greatest=z;
}
if(greatest<k){
greatest=k;
}
return greatest;
}
`
Thank you in advance.