strlen(长度)/sizeof(大小)

int main()
{
    char a[] = "12345";
    char b[5] = "12345";
    char c[100] = "12345";

    printf("%d  %d  %d\n",strlen(a), strlen(b), strlen(c)); 
    printf("%d  %d  %d\n",sizeof(a),  sizeof(b), sizeof(c));     
    return ;
}

输出

5  5  5
6  5  100

 

posted @ 2020-08-19 20:22  五十九  阅读(93)  评论(0编辑  收藏  举报