编译显示成功,但生成时显示Project1.exe已停止工作

#define STDC_WANT_LIB_EXT1 1
#include
#include
int main()
{
char str1 = "to or not to be.";
printf("the string:\n \"%s\"\ncontains %zu characters and %zu bites.",str1,strnlen_s(str1,sizeof(str1)), sizeof(str1));

return 0;

}

#include<stdio.h>
#include<string.h>
int main(){
    char str[]="to be or not to be";
    printf("the string:\n%s\n",str);
    printf("contains %d characters and %d bites",strlen(str),sizeof(str));
    return 0;
}

效果图片说明
不建议将太多的东西放在一起,可以适当的分开,增强可读性。
而且你的strlen用的不是很对