I have a code can printf all of the string element like
#include <stdio.h>
int main()
{
char * c[]={"I love you.","I don't."};
char **p = c;
for(int i=0;i<2;i++) //I judge the number is 2 by my eyes
printf("%s\n",*p++);
return 0;
}
But I don't like that part that I just can know the number is 2
by my eyes.Is there any elegant method can know how many element the array c
contain?A in-built function maybe name count
is ecpected in this post.Such as count(c)
can give me the 2
.