unsign char temp[] = "PM111111111111111",我想加1

大神,
unsign char temp[] = "PM111111111111111",我想加1,应该如何解决呢?谢谢

采纳我,我给你写代码

Hi, I'm glad to answer the problem for you.

There are two ways to solve the promble.

1)"sprintf" function
Example:
unsign char temp[] = "PM111111111111";
char ch = '1';
sprintf(s,"%s%c",temp,ch);

2)"strcat" function
Example:
unsign char temp[] = "PM111111111111";
int n=1;
char s;
itoa(n,s,10);
strcat(temp,s);

)"strcat" function
Example:
unsign char temp[] = "PM111111111111";
int n=1;
char s;
itoa(n,s,10);
strcat(temp,s);

变成 PM111111111111112?