Home > Back-end >  The small white with emergency
The small white with emergency

Time:10-18


How make this? How to capture a single character in the string?

CodePudding user response:

Depending on the string stored in bai variables, methods,

Reference code:
Stored in a char array (support C/C + +)
Char STR []="hello";
int i; for( i=0; STR [I]; I++)
Printf (" % c \ n ", STR [I]);//to a character array STR [I]

for( i=0; * (STR + I); I++)
Printf (" % c \ n ", * (STR + I));//to a pointer to a character

CodePudding user response:

Char STR []="hello a123456";
int i;
for(i=0; I & lt; The strlen (STR); I++) {
If (STR [I] & gt; (' a '- 1) & amp; & STR [I] <(+ 1) 'z' | | STR [I] & gt; (' A '- 1) & amp; & STR [I] <(+ 1) 'Z') {
STR [I] + 'a' - 'a' + 1;
}
}
//z z and then set up himself, the output is a for loop, remember to add a header file string. H
  • Related