#include <stdio.h>
size_t arrSize(int a[])
{
return sizeof(a)/sizeof(a[0]);
}
int main()
{
int alfa[]={1, 2, 3, 4};
size_t s= arrSize(alfa);
printf("\n Array size: %zu", s);
return 0;
}
I'd like to know what I've done wrong here. The output is 2 when it should be 4 instead
I've tried including <stddef.h> but the problem still persists.
The correct output comes only when I don't create a separate func and write size_t s=sizeof(a)/sizeof(a[0])
instead.