For a programming class, we have to make a procedure that only take in as parameter the pointer for an array: void myprocedure(int * myArray)
and then outputs the elements in it. Since I only know how to do so using a for loop,I tried first to calculate the length of the array by using the line
sizeof(myArray)/sizeof(int)
, only to later realize that sizeof(myArray)
doesn't give the size of said array, but rather the size of the pointer.
I need a code that would either let me calculate the size of the array from my procedure, or output the elements in the array without having to know how much are there in.