sizeof和strlen区别
1 #include <iostream> 2 using namespace std; 3 int main(int argc, char *argv[]) 4 { 5 cout << sizeof("goodbye") << endl; 6 cout << strlen("goodbye") << endl; 7 return 0; 8 }
输出:
8
7
1 #include <iostream> 2 using namespace std; 3 int main(int argc, char *argv[]) 4 { 5 cout << sizeof("goodbye") << endl; 6 cout << strlen("goodbye") << endl; 7 return 0; 8 }
输出:
8
7