#include<stdio.h>
#include<conio.h>
void values(int a[4]);
void main()
{
int x[4],i;
clrscr();
printf(" enter 1st number ");
scanf("%d",&x[0]);
printf(" enter remaining values ");
for(i=1;i<4;i++) 
scanf("%d",x[i]);    
values(x[4]);    (cannot convert int to int* and type mismatch in parameter 'a' in call to'value(int *)'
getch();
}
void values(int a[4])
{
int m,max,min,j;
max=m;
min=m;
for(j=1;j<4;j++)
{
if(m>max)
max=m;
j++;
}
if(m<min)
{
min=m;
j++;
}
printf("max and min is%d%d",max,min);
}

:rolleyes:

Arrays in C are passed by reference i.e. meaning that you only need to pass around the array address to the function and that array will be accessed and used in a normal way in that function.

Change you function call to values ( x ) ; and you should be alright.

Oh, and btw, its int main (void) and not void main (void) .

From a previous post:
1) won't use code tags
2) won't format your code
3) won't tell us what the problem is, leaving us to figure it out
4) asking us to finish your program for you
5) continually using 'leet speak'

please mention more about code
i want to know about that.

Oh it seems that you have got a friend in this respect, who is as stumped as you. Read this.

void values(int a[4]); That is a function prototype that tells you and the compiler that function values will have one argument and the argument is an array of 4 integers. values(x[4]); (cannot convert int to int* and type mismatch in parameter 'a' in call to'value(int *)' Here you are not passing an array of 4 integers -- you are only passing one integer that happens to be the 5th member of the array. Because array x only has 4 elements (the elements of array x are 0, 1, 2, and 3) you are passing an invalid element number.

The way to correct the problem is to pass the whole array, like this: values(x);

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.