I'm trying to print all of the values in the four arrays by sending them to a separate function. But, the problem is I can't get the function to print the all of the integers in the array because I'm not sure what I could set the condition statement in the for
loop to, that would be universal to any array of any size.
Right now the function only prints the first 11 numbers. I assume that's because the first number in that array is 11.
#include <stdio.h> void print_array(int a[]); void find_max(int b[]); void find_min(int c[]); void search(int d[]); void SORT(int e[]); int main(void) { int first[11] = {7,7,7,7,7,7,7,7,7,7,7}; int second[14] = {11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, -1, -2}; int third[16] = {-2, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}; int fourth[23] = {-3, 4, 33, 22, 9, -100, 2, 56, 57, 55, 2, 90, 2234, 32, 8, 123, 2, 33, 22, 22, 33, -1, -3}; print_array(&second[0]); return(0); } void print_array(int a[]) { int i; for(i=0;i<*a;i++) { printf("%d ",a[i]); } }