你的浏览器版本过低,可能导致网站不能正常访问!
为了你能正常使用网站功能,请使用这些浏览器。

C语言字符串操作

[复制链接]
gaosmile 发布时间:2020-12-17 23:22
#字符串倒序输出% l0 n7 V8 N% ]3 A9 m

实现逻辑,通过strlen获取字符串长度,然后通过 len/2 进行交叉赋值,这里需要注意,不需要考虑len是奇数还是偶数的问题。

如果len是奇数,最后一个字符就不需要倒序,如果是偶数,最后两个字符就倒序。

#include "stdio.h"
1 ^4 ~/ W$ D, U& b3 z: _
3 r3 n6 L, }* R* }void rechange_str(char *str)4 q7 J( w$ \  Q0 w2 @2 X. ?$ o
{
5 a( L$ \- P' J int i, len;
5 G* [7 V/ u3 c; y$ ~# ` char tmp;4 S- @: V# N9 ~9 I, g* T$ M9 V
if (NULL == str) {: ~: w" o% [3 J) Z
  return ;
$ K0 Y6 d0 ~# u* e/ s, M }
. @+ V2 ~) }& g6 e len = strlen(str);
7 ]+ m6 c% X4 t; w( ^4 i4 {6 q for (i = 0; i < len/2; i ++) {
" ^4 O, Y0 r' F2 X* {5 z0 K  tmp = str;
% s3 L$ ]7 Y$ b# h% Z" s0 z. `  str = str[len-i-1];# ^- _* p4 J( P5 U
  str[len-i-1] = tmp;- U5 ~% e. {/ L' w0 S2 ~
}
) n& p! n; L  F' Z}
: {. t: L4 o  M7 s# Q3 F
0 n+ Y% ^& @0 y8 n$ T" eint main(void)
/ ^& R* _2 f2 z2 o{) F; i* Z) ]1 p; n/ C
char str[20] = "hello,world";9 Q; T5 E  ^% P
printf("%s\n",str);
: w6 s, E' h$ {( D/ P rechange_str(str);3 ^; ^: k; q. p7 E- a
printf("%s\n",str);0 }# Y, k& G4 B( f7 b
return (0);+ T: h8 |+ g7 S* x" \9 k1 b9 K
}
) Z- v3 T. q: p- D+ S6 t

程序输出

hello,world' u0 l8 x6 J2 q4 Y& q8 |- G+ S6 o
dlrow,olleh0 @/ I6 |# q0 a/ a
# W6 ~" t& W6 Q& K1 N
--------------------------------
5 s( _# d* \' ~" Y0 B( t. |Process exited after 0.02841 seconds with return value 0! r$ w  m) I* }5 B. h
请按任意键继续. . .9 v& ?5 K$ V/ T. s
#整型转字符串

实现逻辑,每个整数看其转换进制,从个位到十位百位都可以通过%操作加上/操作获得,再用一个字符数组保存0-F。

用个位数对应值转为字符,注意转换出的字符串是反向的,还要考虑传入的若是负数如何处理,再用翻转字符串完成最后整个操作

下面这段代码需要好好研究一下,最好自己运行试试。

#include "stdio.h"! u' G% M  y- o# E9 T

' @! e7 J, L; `0 Q( nchar *sky_itoa(int value, char *str, unsigned int radix)
, [0 ?+ @: z/ k{4 Q  r1 Y4 b: j  M# R$ s
char list[] = "0123456789ABCDEF";
$ S6 g$ @' d; Z# D: F8 B9 I6 h9 @ unsigned int tmp_value;. H  `, G+ Z9 b& k" ]" _, d/ A
int i, j, k;
# A/ m) i! T0 _# B" A if (NULL == str) {
* g" {( p9 T1 d+ d, B$ g8 C  return NULL;& x; v4 \7 q$ `" v9 }# Z
}9 ]5 f" T. _' P7 ~: f. u/ g% N, F3 }
if (2 != radix && 8 != radix && 10 != radix && 16 != radix) {
2 K. ^4 d; O: i. |! l  g  return NULL;% J% P* H  W7 ^$ X7 O
}9 x) K2 P2 l6 O- q* V# |
i = 0;' U2 P# ?, p' T7 L. M4 a
k = 0;# m  ~: f* N$ \% F2 c. {: j9 Y
if (radix == 10 && value < 0) {
: v1 [$ V- B3 g+ n, T' v6 t  tmp_value = (unsigned int)(0 - value);
  _- h0 u& ~! O- `. f6 b3 v9 O  str[i++] = '-';
! g5 o' c' v7 t9 g  k = 1;, o$ G; w  w& @) w
} else {
! l5 D8 s8 P! {! B+ H+ _) w  tmp_value = (unsigned int)value;7 ]9 A6 k4 v# q: D
}
0 A+ v0 u3 C( R% E do {) a- V8 [2 ~. ]! r+ ~! I: o
  str[i++] = list[tmp_value%radix];( t9 _7 M& C, B- ]) N3 W( M
  tmp_value /= radix;
+ B" x2 `) t. ~, i  d } while(tmp_value);
! O2 y0 J$ {9 H6 a8 o+ g9 V$ P str = '\0';8 }; s2 F( ^7 q% t
//翻转  Y8 s& U! R1 _# c5 Y3 e
char tmp;- P) y5 J9 Z9 Q! c6 I6 A* z
for (j = k; j < (i+k)/2; j++) {% b. D( V! ^) g# p$ w" J
  tmp = str[j];. |& w7 k6 T6 t9 K& J. a" ]
  str[j] = str[i+k-j-1];% m3 d7 |0 @3 o- ]* \3 r/ x
  str[i+k-j-1] = tmp;
+ p% e, F1 f. O% \/ I7 @ }
5 T) n7 [7 T% S1 T. {+ X7 E3 G return str;+ E$ W3 B( W' \$ a6 I" I0 b
}& x& J8 a/ N, k

! k0 J, @" a) l7 a, W7 @' wint main(void)
1 k$ g+ g  a  o7 `2 M2 O7 W2 l4 s{: ~" Z) F% o6 L% b) p' A5 P
int a = 1254545;
; x9 }6 N5 \& M- U- l! I9 a char str[100] ={0};
, L  B/ W. A: ^7 E7 ?& G, N7 {2 f: [" [! K
printf("%s\n",sky_itoa(a,str,2));) z( u; v  I  T0 G# r1 g% E
printf("%s\n",sky_itoa(a,str,8));
$ g- |( T1 f& V6 q( v printf("%s\n",sky_itoa(a,str,10));
! c$ T0 R4 J4 h4 [ printf("%s\n",sky_itoa(a,str,16));
+ V* P* E0 ^1 m+ j# ] return (0);8 b8 W" h' R$ @7 z3 ^* B% X
} ( I' m, z% ?$ I- I

程序输出

100110010010010010001
) V2 [- W0 U2 C. {( ^4622221
" A. }) S$ ~5 L. p, ]# `1254545
9 f0 Z* e) _# p7 Y1324911 f7 U1 ?- m0 n

) x9 m3 }' Z# S4 m( T- m--------------------------------
0 E8 L6 R/ p) k& y# @, uProcess exited after 0.02963 seconds with return value 0
- J  Y5 g! m! V: E5 r( ?4 z* v请按任意键继续. . .4 T: C7 j" w, K/ R. n/ f
#字符串复制

实现逻辑,逐个赋值直到遇到'\0'停止即可

#include "stdio.h"
6 g4 N* L" |$ [& K" m
7 y- u  i3 ?% P/ I7 R' ?5 F6 S+ ?) Jchar *sky_strcpy(char *dst, const char *str)& s' e$ b- R, |5 N; h+ ]
{& E. G* P4 U7 V' q+ T
if (NULL == dst ||  NULL == str) {
" j$ \$ S4 x" ~  return NULL;
/ e* X5 E/ m: n! j3 k$ H1 N }) `1 o: W' X4 W2 l; M9 g
char *ret = dst;
0 E, W9 Z# M- G0 n. K4 b$ Y# x while (*str != '\0') {
2 v+ m% U1 @+ |4 b  *dst ++ = *str ++;
7 m' m, C( p5 m+ [% F }5 o& E6 P8 U' z: Y5 H4 {5 E; V1 h& r" W
return ret;
: u3 b$ U, s: k0 k  c1 \} / B! X9 D1 E1 t% q. o7 [
& Z* }  Q* N% D' E
int main(void)- r% f5 v$ L/ t5 z
{
, F$ R1 H6 G( s/ ~$ B8 i: J# L+ A char str_1[100] = "hello,world";
# c7 J9 {) i( R1 z! }3 p5 z char str[100] ={0};3 s8 \2 g& }8 b

8 U: j7 B5 n8 ^/ n( ? sky_strcpy(str,str_1);$ u9 G: ~3 f$ O  A& _% I
printf("str_1:%s\n",str_1);3 o8 N# V* @# t( f* x
printf("str:%s\n",str);! T& w: |+ \8 y/ M1 @. _
return (0);
  K4 i$ V0 s  \5 Z2 o8 {} : i% s( u" ]6 ~" F0 e3 s. P5 C

程序输出

str_1:hello,world  d. A0 i% ~% b7 M: w6 L( x) \
str:hello,world5 B2 B- X! U& Q% ?

, C( }" a0 E2 a' }--------------------------------+ b2 K3 Q9 w9 R* c& R) u
Process exited after 0.03334 seconds with return value 0, F6 W0 A; R9 r. I3 {/ w! W4 _
请按任意键继续. . .
( x9 h! d  A, i* _& e
#字符串比较

1、正常比较是否相同 实现逻辑,判断字符串长度是否相同,若相同逐个比较字符是否相同

#include "stdio.h"
$ ?( m! P( r# H+ J
& n% Y2 L1 I( q8 c  L: o- ]int sky_strcmp(char *dst, char *str)# ^; p6 g- H# }- F) v4 A
{
7 D( ]+ Y) a# p  J/ z0 D) P int i, len;$ z+ Y! @* M4 ]* k2 A7 v/ S
if (NULL == dst || NULL == str) {. d# q4 B4 m& ~. }3 Y
  return 0;* q' J7 E" D" d# |
}
# s# \! c& ]4 |/ @( j# ]/ R if (strlen(dst) != strlen(str)) {
! r/ ~( ]3 i% g4 q. b6 X. Z0 {  return 0;- y8 q: C- f0 \; W& V% C% w
}
2 {  t. `4 ^( L3 U len = strlen(dst);0 J5 K8 q5 {. M8 W4 ], g
for (i = 0; i < len; i++) {; R8 o3 g2 I. |9 w
  if (*dst++ != *str++) {
* }9 q, K6 E3 Z: ~   return 0;
) h  G: a! j$ M  }
" I9 L# R0 M7 P  l }% z2 r" f. `  l% i; ~* b$ e( t
return 1;
- d, d" R/ `! S3 W" }. S}
% ^8 g3 \- ?4 @7 e% N
1 l, o6 S9 Z. Q, t) p, q9 c; @int main(void)
# d4 Q  X1 G* d& }$ Y& R6 _{
$ i' z3 E, S4 |7 ^ char str_1[100] = "hello,world";& V  ?5 l  u# D# y* ~; m
char str_2[100] = "hello,world";
4 i% Z& q% d9 A! [5 A char str[100] = "adfs";
+ e# [$ \0 O5 N  W3 \2 X+ { 4 B. c9 [+ e2 n, l! C
printf("%d\n",sky_strcmp(str_1,str));7 @2 V; {4 q3 y) ^2 U) M) X2 x
printf("%d\n",sky_strcmp(str_1,str_2));: c3 K6 i2 e% i8 c
return (0);& a- R# [# n0 `- G# |" e
}
' A" D: `) |0 b0 m/ K

程序输出

0, v" P5 u+ \' \
1& o9 s2 |1 Y' ?; Z, Z
' [4 x% ]/ S7 P3 j( s; H
--------------------------------
: L: G& H2 Z" P2 Z; UProcess exited after 0.02802 seconds with return value 08 Q4 }/ q/ ~3 l; W
请按任意键继续. . .
) A- D0 c% J0 m8 S; W9 \

2、忽略大小写字符串比较

实现逻辑,在比较字符时可以将其统一转换为大写或小写,然后再进行比对即可,和正常对比无其他不同

#include "stdio.h"
2 l4 j0 R- B! t( c* Q ( a* V9 V6 p' I( T, r" ]
#define CONVERT(c) (((c) >= 'A' && (c) <= 'Z') ? ((c) - 'A' + 'a') : (c))
& d; y! U, _- p. ^" g int sky_strcmp(char *dst, char *str)4 [3 {$ W3 ?5 Y$ ^
{
* s/ C, Y2 u! k3 k; x, \  D* |  int i, len;
5 h. l% v1 K/ R  if (NULL == dst || NULL == str) {: H4 R1 g! G) e+ h& ~0 _' m4 j3 c
   return 0;4 @+ _$ J/ ]* g) t6 A
  }
4 A' o5 G/ L6 ^" L+ _1 B9 O  if (strlen(dst) != strlen(str)) {
) |/ C! m- m8 H5 O: x9 d% t* l   return 0;/ n0 p* J% Z) h+ t
  }
7 a5 M# A& P: E5 j9 Y# p  len = strlen(dst);. B8 M) C6 C9 V+ ?) n' g# f/ ~
  for (i = 0; i < len; i++) {' Z& ~# _% S5 p$ I; x' g; X1 ?
   if (CONVERT(*dst) != CONVERT(*str)) {$ U* r( d& F! j; [4 }
    return 0;
- ^6 E+ M) Z1 E9 Q   }( ]) b: C& w/ w
   dst ++;
2 o7 G  [+ Y! o+ V/ x8 x# W: k  G   str ++;
, x! s( n" m% p1 N7 |7 }. V5 _/ r  }: l1 y: v, u6 ^6 s1 N
  return 1;
$ L* g' \) O# w. Y' D5 ~ }
' _! L- t; w/ Q* O6 }, r4 e
+ K5 G. \$ k) J: A1 e* [& h int main(void)
: m2 x* V2 c! X8 a$ G {( g2 O- x/ ?3 l. A+ i4 g% A
  char str_1[100] = "heLlo,world";
- [2 l$ }. x( O8 B  char str_2[100] = "hello,world";, z5 G& D& o( l4 Y
  char str[100] = "adfs";
( R2 }. {7 J7 h4 r  8 B  @9 Q- |) G; [# ~1 Y
  printf("%d\n",sky_strcmp(str_1,str));
; E8 J4 v6 C0 B% m3 U! n/ J4 {) ?  printf("%d\n",sky_strcmp(str_1,str_2));- o' A- P8 Z/ `  L- M. A
  return (0);
) y) Q4 p. p; |; t* \ }
7 i. o+ u5 x! M* u, G7 i, D

程序输出

04 @/ I2 E8 D0 l( \6 Z+ f
1
/ Q9 M0 `0 o- U7 y3 E, e7 F0 R7 j2 v( z5 s0 R/ I1 l* j' F. z
--------------------------------
2 C+ W, s" T' |/ b" T6 q1 t' u  BProcess exited after 0.04624 seconds with return value 0
9 w1 k& J/ y% d6 H. M1 q请按任意键继续. . .+ q7 v( j5 L! t. S6 B$ W
#memcpy函数实现

实现逻辑,主要就是逐个赋值即可完成

1、不考虑拷贝覆盖问题

#include "stdio.h"9 g5 [! M5 B7 C+ k& L9 Y
#include "string.h"% M5 B% p5 \9 U- R( e

  J- T. @8 _- |* g( Vvoid *sky_memecpy(void *dst, const void *str, int n)
' L# Y$ r, e; Q/ F0 B& h: R{
! r& a6 D0 b$ h! A) k; J+ _, M+ a2 E1 n if (NULL == dst || NULL == str || n <= 0) {: B/ V  i  P) i- R5 x4 n8 N: h
  return NULL;# D. d3 [, X) k4 @% s
}( _" h+ E: `4 T6 l2 h1 q9 ?5 F
char *pdst = (char *)dst;' Q) \7 J" e4 v
char *pstr = (char *)str;7 o. B. l) W; @+ p
while (n --) {4 f, y1 p, _2 t) E" I
  *pdst ++ = *pstr ++;
3 _* _5 J! R3 y, I! u; f( g1 V6 f3 R }0 F, y- A9 P2 z/ ?( {5 I% d1 T! s
return dst;6 u' B; F! c8 @: _5 F6 F* |
}
) b0 y% ^% d) r  i0 w; ~
* Q; R3 \- I; Gint main(void)
+ T% ~' W# f# ?2 v{" H6 Z7 `; D' U. W8 K  o
char str_1[100] = "heLlo,world";0 m# [% [% V" e. Z
char str_2[100] = "sdfsdfs";
. v2 i4 U) p% q; ^% q+ _. X sky_memecpy(str_2,str_1,strlen(str_1));( F1 }7 k# i% g3 T& F+ @
printf("%s\n",str_2);
1 Y) U  J: B2 r- b4 w return (0);2 B) _& [- ^+ L1 X; d( X
} . L2 n( J( [, q$ q; v9 ~

程序输出

heLlo,world! H0 q- L( i5 s+ y: Q
) g- ?; L: ?& ~# u' C& R9 \
--------------------------------7 n# S' r+ D  p$ X( _
Process exited after 0.02516 seconds with return value 0
* e+ M, A5 I! x! x) ]2 s: U请按任意键继续. . .% T4 T2 r. ~! T+ z, w8 o
( o# s3 ^5 ^, ]9 z5 i! |1 T' A) q

2、考虑拷贝覆盖问题

拷贝覆盖是我们在拷贝字符串的时候需要注意的一个问题,我下面的示例程序,使用第一个函数的时候,就出现了问题,使用第二个函数就没有出现问题。

原因是,我们源字符串和目的字符串的地址都是一样的,我们希望把字符串往后移动一个位置,但是实际上出现了问题。

#include "stdio.h"
9 r" [+ @1 C0 d- F" B5 x #include "string.h"# S' i+ d" Z2 v& u% Z2 H

. g5 `  w0 J+ e; \6 M void *sky_memecpy_1(void *dst, const void *str, int n)
. z5 B! e0 j5 J% K {
  H" \* v* s+ b$ U% y  if (NULL == dst || NULL == str || n <= 0) {
& ^; O5 |1 C: Y. `   return NULL;* c  C/ E0 _) K9 x# p
  }# A( U2 b6 x7 ^3 }$ k+ B' y
  char *pdst = (char *)dst;
7 K8 @4 |* Z, b4 y, u  char *pstr = (char *)str;7 \  \  i( H) _0 h
  while (n --) {. Z6 I# E- r5 T
   *pdst ++ = *pstr ++;
7 w) U5 v- X/ H! S9 E  }
8 b- D  z, t# ~$ B/ y8 n  return dst;1 ]  k+ W, Y/ |; O* M1 U) g1 @. }
}( v: ]9 @# s! n

' c+ [! u6 b8 l/ F; d. d void *sky_memecpy(void *dst, const void *str, int n)* g% w. r2 e) I- S# h  e
{
: l5 J5 |0 ^6 L; R) F8 |6 p& F  if (NULL == dst || NULL == str || n <= 0) {4 ~/ ~9 h* ~6 r/ c7 U* R2 y
   return NULL;. k$ I$ n( n% g- a
  }
* @, i; O9 `5 h6 ]6 z  char *pdst = (char *)dst;3 W1 i; ?- G0 F0 l
  char *pstr = (char *)str;5 ]/ _) a3 f  Z( R3 R& |
   
3 g# F5 Z( k! t: _: u  U! W3 N  if (pdst > pstr && pdst < pstr + n) {
- x# E. _  y. ^+ f6 f( [   pdst = pdst + n - 1;  P- m% J4 }0 g% [, b0 N9 T) e
   pstr = pstr + n - 1;
3 a- i4 ^: y6 t0 E   while (n --) {
2 g  u) F$ h% |8 ]# i& g" Q    *pdst -- = *pstr --;
0 q. B; Z/ f$ E. \7 p   }% p( L$ w7 T7 Z
  } else {
2 b% A" i' G  x4 [6 S- B6 @: M   while (n --) {. I. u! u9 {' @  t- p
    *pdst ++ = *pstr ++;- x/ x% u# W& q
   }
% h% V3 w$ T) J6 w* u. d1 z  }
5 E) X6 H6 a; E8 Y# r6 F  return dst;* \& T" G. i! I# j3 F
}
2 f8 u2 d3 `% v7 m# W" Y/ z8 p
  K8 A. E# \. B1 \9 t int main(void)
# t% I6 s' s/ P4 T& ]0 j {3 U7 c  l: M+ f$ c
  char str_1[100] = "heLlo,world";- ~! C% [' e( o$ q3 w$ P
  char str_2[100] = "heLlo,world";
. v5 y* X. {" |# ]  sky_memecpy_1(str_1+1,str_1,strlen(str_1));
. n7 `! d- N7 K! e" L3 K  printf("%s\n",str_1);- N) }" P$ w! v$ Y3 `4 Z8 T
  # M) ?" n8 W. }
  sky_memecpy(str_2+1,str_2,strlen(str_2));* x3 }% A) c: h7 C
  printf("%s\n",str_2);# R/ }1 p: l3 [, J; L/ |5 S
  return (0);
/ P/ q; n0 n; |! u5 L  _ } ( ~2 E* S' }2 ?+ T" R% V6 w

程序输出

hhhhhhhhhhhh
9 C! q' z( ^& d' FhheLlo,world
* ?2 s9 {+ f2 ~- b7 O6 e7 ~0 T, ]0 i
--------------------------------
( y! b8 I9 c+ P$ x! V2 |7 l6 f$ qProcess exited after 0.02773 seconds with return value 0
) @2 }6 X/ `: u2 D* _请按任意键继续. . .
; H/ R6 z) O4 i4 i0 i; ?% U

针对上面的拷贝覆盖问题,单独写了一个测试程序

#include "stdio.h"
1 |, b1 q. ]2 R1 E4 S#include "string.h"
2 a' O* t! g' T) S$ V+ U% ~& w# u+ u4 A8 c, J# {* ]
void *sky_memecpy(void *dst, const void *str, int n); _# y5 y! _+ A& B$ O1 a: N6 M; C
{$ S2 y( ~( D: E* \& `! x
if (NULL == dst || NULL == str || n <= 0) {$ L6 P0 c% |$ H4 P$ E. N! y
  return NULL;# q7 j/ z1 L- K- q3 v. ^7 c$ w
}
, Y" f* u3 z+ T; y char *pdst = (char *)dst;) {$ U6 M, L5 s0 ]* l
char *pstr = (char *)str;: i0 Z: i8 I5 O' E; s/ _1 L1 X
while (n --) {
" T2 X6 B0 |) {. S6 E  printf("dst:%c--->str:%c\n",*pdst,*pstr);, d! n0 {4 K9 r. r" a! t4 o1 d
  *pdst ++ = *pstr ++;
6 N1 K- z" E  q: \, O }( k: |) h2 W4 {! F( |
return dst;5 g% h0 y2 ^% ^8 R  V# D
}
1 N7 q  {& h7 L
* |6 B* t+ R: e: Y+ Oint main(void)( _  v( m9 y2 I3 w7 ~' j- X  {
{
9 R7 n. }  x" o" w4 `8 h, M2 Z, w char str_1[100] = "heLlo,world";
2 G7 S3 v) T7 m" Y9 a/ T* I( j8 \ sky_memecpy(str_1+1,str_1,strlen(str_1));
5 f( S( n0 T7 S printf("%s\n",str_1);
- `6 \- t% E1 O  M& P return (0);
( Z  V* u' v' X. I8 k6 |}
( e9 ^  s+ ]  j' ~5 `

程序输出

dst:e--->str:h
& G* u+ l5 _# T7 j' R: odst--->str:h. r0 K5 [4 R2 [+ j. I. ?" L
dst:l--->str:h
9 J2 G) Q- D$ ^/ p  X8 Ddst--->str:h8 D7 ~7 z2 G+ |+ S8 v& }
dst:,--->str:h# ]0 d. ^- j: u( }! Q
dst:w--->str:h
3 l+ K9 A3 R' |- |$ `$ [( F; Jdst--->str:h
3 `+ V  Y6 P% G. Vdst:r--->str:h  M% p9 i" i7 b
dst:l--->str:h
5 h$ ^0 m! V, ^9 Idst:d--->str:h
8 Q9 e" f" \/ U6 ?+ Qdst: --->str:h+ b4 w; W9 }' |0 f5 w0 [. l
hhhhhhhhhhhh; J; ~3 Y* G' ]1 A& U) `, h  }7 u0 x0 J

) D+ V( T  C1 j  R, R# P--------------------------------9 @  {# c4 q8 B  w* ?" i
Process exited after 0.02575 seconds with return value 0
% l/ Z* _9 y8 t3 s请按任意键继续. . .  e! x# m$ ]$ g4 t# I  j5 w8 w
- X( f5 C" m0 L7 ]0 C0 f

初始的时候,dst指向 e 字符,str 指向h 字符,然后每次都是dst先移动,str再移动,就出现了dst被h字符所覆盖。

# {; z# |' l. l2 s
赞 收藏 评论0 发布时间:2020-12-17 23:22

举报

0个回答
关于
我们是谁
投资者关系
意法半导体可持续发展举措
创新与技术
意法半导体官网
联系我们
联系ST分支机构
寻找销售人员和分销渠道
社区
媒体中心
活动与培训
隐私策略
隐私策略
Cookies管理
行使您的权利
官方最新发布
人形机器人运动控制、感知与智能配电
半导体创新技术与应用方向
EE架构与软件定义汽车
12V/48V 汽车智能配电(SPD)
区域控制单元(ZCU)与分区架构
关注我们
st-img 微信公众号
st-img 手机版