I have written the following code to identify the end of array
Code:
#include <stdio.h>
unsigned int array[20]={21,22,23,12,1,0,6,7,'\0'};
int main() 
{
    // Write C code here
    unsigned int max=0;
    unsigned int index=0;
    while(array[index] != '\0')
    {
        if(array[index] > max)
        {
            max = array[index];
        }
        index++;
    }
    printf("max = %d\n number of elements = %d",max,index);
    return 0;
}
The output of the index is 5, which is not expected. How do i update the logic to identify the end of array?