Strlen() in C

Would strlen() work for int array?

<#include<stdio.h>
void main()
{ int b[100];
int a=10;
do
{
b[i]=a%2;
c=a/2;
a=c;
}while(a>=2)
len=strlen(b);
printf("%d",b[i]);
getch();
}>

The len doesn't work properly. When variable 'a' is initialized a greater number, the output for len is 4. When b[100] is given in place of b[i] in printf(), the answer is 6. How can I get the length of the array correctly for any value of variable 'a'. Please help me. Thanks.
Strlen will not work for non-null-terminated character arrays.
What do you mean by length of array? How would you say that array has a given length? For example what is the lenth of your b array?
Topic archived. No new replies allowed.