Skip to content

Commit ce2b786

Browse files
committed
first commit
1 parent e55d084 commit ce2b786

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

test_str.cc

+16
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)