hi all.


i'm newbie for c-prog,
in school, given question

Finding the Smallest Value (small.c)
(a) Write a function, smallest( ), that returns the smallest value in a signed integer
array. The array and its size are passed as arguments.

(b) Write a main program that inputs MAX values from the keyboard into a signed
integer array, array, and prints, using smallest( ), the smallest value to the screen


currently my find the smallest loop and passing argument seens like not correct.
able to compile and run...but result not correct...can somebody kindly enlighten me plz...




Code:
/*Small.c*/

#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,i;


	for(j=0;j<MAX;j++)
	{



	/*find smallest */
	for(i=0;i< (num[i]-1);i++)
         {		 size= i;

		for(j = i+1; j<MAX; j++)
		{ if(num[j] <num[size])
			size=j;
			}
	printf("%d\n",i);


	}
	printf("%d",size);




}


}