I'm trying to print an array, however it is only printing one element of the array.
void printArr(int arr[])
{
int a;
for (a = 0; a < _countof(arr); a++)
{
printf("%i, ", arr[a]);
}
}
main()
{
int nums[] = { 3, 54, 1, 7, 8, 90, 65 };
printArr(nums);
}
I have figured out that it is because the _countof macro is returning 1, but I have not been able to find a fix for the problem. (I know that I can manually enter the size of array, I want it to work for all arrays.)