I want the output to be 6 and 4 four array A and B but I cant figure out where I made a mistake. I read a tutorial on StackOverflow where u can calculate a int array length by doing length = sizeof(array)/sizeof(array[0]), but it just doesn't work in my program. The values of sizeof(array) and sizeof(array[0]) stay constant regardless if I change the array as shown below.
#include<stdio.h>
#include<string.h>
int arraychecker(int array[])
{
int Length =sizeof(array)/sizeof(array[0]);
int arraylength = sizeof(array);
int arraylength0 = sizeof(array[0]);
printf("%d,%d,%d\n", Length, arraylength, arraylength0);
}
int main()
{
int a[]= {2,1,3,4,9,33};
int b[]={2,55,3,2};
arraychecker(a);
arraychecker(b);
return(0);
}
output: 2,8,4 2,8,4