We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e55d084 commit ce2b786Copy full SHA for ce2b786
test_str.cc
@@ -0,0 +1,16 @@
1
+/*
2
+ this program is to test the function of sizeof() and strlen(). See return value of two different functions.
3
+*/
4
+#include<iostream>
5
+#include<stdlib.h>
6
+#include<string.h>
7
+using namespace std;
8
+
9
+int main(){
10
+ char* testchar="test";
11
+ string teststr="string";
12
+ cout<<"Use sizeof(): "<<sizeof(testchar)<<" "<<sizeof(teststr)<<endl;
13
+ cout<<"Use strlen(): "<<strlen(testchar)<<endl;
14
+ return 0;
15
16
+}
0 commit comments