strlen 和 sizeof 之区别

#include <stdio.h>
#include <string.h>

int main()
{
    char mesg[] = "\0";
    
    printf("strlen of mesg:%d\n",(int)strlen(mesg));
    
    printf("sizeof mesg:%d\n",(int)sizeof(mesg)/(int)sizeof(char));

    return 0;
}

posted @ 2022-11-10 13:52  轩邈、  阅读(31)  评论(0编辑  收藏  举报