I have a program that aims to calculate the number of elements that an array has. For that the arrangement enters a feature count_elements that counts the number of items and returns the total. The issue is that when I try to show the content of the fix, it throws the following error: How can the failure or error be solved?
#include <stdio.h>
#define TAMANIO 12
int contar_elementos(int a[TAMANIO]);
int main()
{
int a[ TAMANIO ] = { 1, 3, 5, 4, 7, 2, 99, 16, 45, 67, 89, 45};
printf( "El total de los elementos del arreglo es %d\n", contar_elementos(a[TAMANIO]));
return 0;
}
int contar_elementos(int a[TAMANIO]){
int i, total = 0;
for ( i = 0; i < TAMANIO; i++ ) {
total = total + 1;
}
return total;
}