Home > Back-end >  (details) to split a string into a number of repeated substrings
(details) to split a string into a number of repeated substrings

Time:12-09

# include "stdio.h"
# include "string. H"
Int main ()
{
Char x [150], p [20] [20].
Int a, b, c, d=0, e=0, f=0;
//int [20] p;
Gets (x);
P=x [f] [d] [0];
For (a=1; A{
If (p [f] [d]!=x [a])
{
For (e=0; e<[f] strlen (p); E++)
{
If (p==x [f] [e] [a])
break;
}
If (e==strlen (p [f]))
{
D++;
P=x [f] [d] [a];
continue;
}
}
f++;
d=0;
P=x [f] [d] [a];
}
F=0;
While (p [f] [0]!='\ 0')
{
[f] puts (p);
f++;
}
}


If, in accordance with the above source input: abcdea
Get output:
Abdce
A 
Here is the code
Here is the code
Here is the code



When I put the char x [150], p [20] [20]. Instead of char x [150], p [20] [20]={} '\ 0'; When can get the expected result:
Abdce
A


Would you please tell me why this is, my understanding is: if a character array is defined and there is no assignment, are all of its elements are '\ 0'
Deviation, but understand it, but there was one, that is my understanding is wrong? For help
  • Related