/********************************************************************** * * Copyright (c) 2015,wk Studios * * Filename: A.h * * COMPILER:GCC VC 6.0 * * author:wk * * time:2015 6 7 * * * * * * * * * / #include <iostream>using namespace Std;void Main () {char a[100]={' 0 ', 48,48,0,0, ' 0 '};char b[]={' 0 ', 48,48,0,0, ' 0 '};char c[]={' 0 ', ' 0 '};char d[]={0};// Note that the number 0 differs from the character ' 0 '//' + ', which is equivalent to the number 0 instead of the character 0cout<<sizeof (a) <<endl;cout<<strlen (a) <<endl;cout< <sizeof (b) <<endl;cout<<strlen (b) <<endl;cout<<sizeof (c) <<endl;cout<< Strlen (c) <<endl;cout<<sizeof (d) <<endl;cout<<strlen (d) <<endl;
Operation Result:
100
3
6
3
2
7
1
0
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Think 2 when you are idle (' + ' is equivalent to the number 0 or the character 0)