thanks a lot...
really not familiar with passing pointer/argument, but i had re-arrange the structure..
but i still not sure will i declare wrongly
for the function prototype, call function in main() & funtion ??
for function prototype & function , there are written all the same right?
example=int smallest(int num[], int size);
Code:
#include<stdio.h>
#define MAX 4
int smallest(int num[], int size);
main()
{
int n,i,y,h;
int num[20];
for(i=0;i<MAX;i++)
{
printf("Please enter number:");
scanf("%d", &num[i]);
/*printf("%d", num[i]); test for input */
}
h=smallest(num,sizeof num);
printf("The smallest number is %d",h);
getch();
}
int smallest(int *num,int size)
{
int j,k;
for(j=0;j<MAX;j++)
{
k=((k>num[j])?num[j]:k);
/*conditioner operator:If y>max[i],=max[i], else=y */
printf("%d\n",k); \\test
}
printf("%d",k); \\test
return k ;
}