摘要:
sizeof考虑“\0”,strlen不考虑“\0”#include<stdio.h>#include<iostream>#include<string.h>using namespace std;int main(){ enum m{a,b,c,d,e,f,g,h,i,j,k,l}; cout << sizeof(m) <<endl;//4 枚举类型类似于指针 cout << sizeof("\0\0\0") <<endl;//4 3个\0 + 末尾的\0 = 4 cout << 阅读全文