You do not call le_vet in your main function, you rather do something more by creating a function pointer called "le_vet", which takes an int (by default, because the type is not specified) and returns invalid. I am pretty sure that this is not what is needed.
Instead, change void le_vet(n) to le_vet(v, n) and change this:
void le_vet(int v[1000], int n, int i) { for (i = 0; i < n; i++) { printf("Type the number %d: ", i+1); scanf("%d", &v[i]); } }
:
void le_vet(int v[], int n) { int i; for (i = 0; i < n; i++) { printf("Type the number %d: ", i+1); scanf("%d", &v[i]); } }
Since you do not need to pass i from outside the function, there is no need to include it in the arguments of the function. The first element in the for loop runs once right when the loop is introduced, so it is often used to declare an iteration variable for the loop, as I did here.
EDIT: Oops. Can't do it in C. I have to use for C ++ what I did goof here. Declare i just above the loop, as @Over Flowz suggests. Updating my revised code, but leaving this entry as evidence that it is time to stop working and go eat lunch :)
source share