#include <stdio.h>
#include <string.h>
int main ()
{
int a,i=0;
char ch[10000];
while (scanf ("%d", &a)!=eof&&a!=-1)
{
ch[i++]=a;
}
/*
test Results The sizeof test is the total space including the \ n
strlen test is the length before the first hit
*/
printf ("sizeof calculates the length:%d\n", sizeof (CH));
printf ("strlen Calculated length:%d\n", strlen (CH));
char th[]={"abc"};
puts (TH);
printf ("sizeof calculates the length:%d\n", sizeof (TH));
printf ("strlen Calculated length:%d\n", strlen (TH));
// char sh[];
char sh[]={' A ', ' B ', ' C ', ' \0 '};//char sh[]={' A ', ' B ', ' C '}; This is the wrong assignment so that the assignment does not follow the result of abcabc printing sizeof One less
// memset (sh,0,sizeof (SH));
sh[0]= ' a ';
puts (SH);
printf ("sizeof calculates the length:%d\n", sizeof (SH));
printf ("strlen Calculated length:%d\n", strlen (SH));
}//Test data
/*
1 0 2 0 1 0 0-1
Normally assumed to be 7
High precision operation when initialized is empty so add character 0 to calculate it's going to happen.
*/
String assignment method to understand some differences between sizeof and strlen