| |

VerySource

 Forgot password?
 Register
Search
View: 670|Reply: 3

Questions about replacing "\0"

[Copy link]

1

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-1-7 11:40:01
| Show all posts |Read mode
I declared an array of strings,
char a [30]
After I enter the string "abcd", the system automatically adds\0 to the end
Now I want to replace\0 with another character, a [4] = 'e'
But unsuccessful, how should I achieve it?
Reply

Use magic Report

0

Threads

4

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-1-7 13:51:01
| Show all posts
How could it be unsuccessful? Direct assignment is definitely possible. But do n’t forget to put a '\0' in the end
Reply

Use magic Report

1

Threads

2

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

 Author| Post time: 2020-1-7 14:54:01
| Show all posts
I want to remove / 0, no more
Reply

Use magic Report

0

Threads

19

Posts

12.00

Credits

Newbie

Rank: 1

Credits
12.00

 China

Post time: 2020-1-7 15:45:01
| Show all posts
When outputting a string, loop through the output one by one. See if this works.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list